# Transient attribute that is not derived in HS6

**URL:** <https://discourse.hibernate.org/t/transient-attribute-that-is-not-derived-in-hs6/4803>\
**Category:** Hibernate Search\
**Created:** [November 24, 2020, 5:13pm UTC](https://discourse.hibernate.org/t/transient-attribute-that-is-not-derived-in-hs6/4803 "2020-11-24T17:13:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tadgh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/tadgh/32/1289_2.png) [@Tadgh](https://discourse.hibernate.org/u/Tadgh)\
**Post date:** [November 24, 2020, 5:13pm UTC](https://discourse.hibernate.org/t/transient-attribute-that-is-not-derived-in-hs6/4803/1 "2020-11-24T17:13:17Z")

</div>

I am using Hibernate Search 6.

I have an entity which contains a string field which I would like to index, but not persist. As such it is marked as @Transient. This is the field in question

```auto
	@Transient
	@FullTextField(name = "myContentText", searchable = Searchable.YES, projectable = Projectable.YES, analyzer = "standardAnalyzer")
	@FullTextField(name = "myContentTextEdgeNGram", searchable= Searchable.YES, projectable= Projectable.NO, analyzer = "autocompleteEdgeAnalyzer")
	@FullTextField(name = "myContentTextNGram", searchable= Searchable.YES, projectable= Projectable.NO, analyzer = "autocompleteNGramAnalyzer")
	@FullTextField(name = "myContentTextPhonetic", searchable= Searchable.YES, projectable= Projectable.NO, analyzer = "autocompletePhoneticAnalyzer")
	@OptimisticLock(excluded = true)
	private String myContentText;

    public void setContentText(String theContent){
        myContentText = theContent;
    }
	public String getContentText() {
		return myContentText;
	}

```

I want this field to be reindexed whenever this entity is persisted. Since this field is not _derived_ from anything, I can’t use `@IndexingDependency(derivedFrom=)` method. I have tried adding

```auto
@IndexingDependency(reindexOnUpdate=ReindexOnUpdate.SHALLOW)

```

expecting this to cause a reindex whenever the relevant setter is called, but it is throwing this bootstrap error:

```auto
Context: Hibernate ORM mapping, type 'ca.xxx.yyy.jpa.model.entity.MyEntity'
Failure:
 org.hibernate.search.util.common.SearchException: HSEARCH800007: Unable to resolve path '.myContentText' to a persisted attribute in Hibernate ORM metadata. If this path points to a transient attribute, use @IndexingDependency(derivedFrom = ...) to specify which persisted attributes it is derived from. See the reference documentation for more information.
	at org.hibernate.search.mapper.orm.model.impl.HibernateOrmPathFilterFactory.resolvePropertyNode(HibernateOrmPathFilterFactory.java:353)

```

Is there some way to accomplish what I’m after here? It is essentially a desire to index a field which is not persisted

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [November 25, 2020, 7:38am UTC](https://discourse.hibernate.org/t/transient-attribute-that-is-not-derived-in-hs6/4803/2 "2020-11-25T07:38:11Z")

</div>

First, a warning: if you don’t store this value in the database, upon [mass indexing](https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#mapper-orm-indexing-massindexer), Hibernate Search won’t be able to retrieve it, and thus it will be lost.

If you ever need to rebuild the index (for example because your mapping changed, or because you’re upgrading to a new, incompatible version of Elasticsearch or Lucene), this data will be missing in your new index.

If that’s fine with you, just use `ReindexOnUpdate.NO`:

```auto
@IndexingDependency(reindexOnUpdate=ReindexOnUpdate.NO)

```

See [this section of the documentation](https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#mapper-orm-reindexing-reindexonupdate-no).

---

<div class="post-metadata">

**Author:** ![Tadgh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/tadgh/32/1289_2.png) [@Tadgh](https://discourse.hibernate.org/u/Tadgh)\
**Post date:** [November 25, 2020, 2:37pm UTC](https://discourse.hibernate.org/t/transient-attribute-that-is-not-derived-in-hs6/4803/3 "2020-11-25T14:37:59Z")

</div>

Thanks a lot for your detailed reply. This should work for me 🙂
