# Error while searching with unavailable attribute in hibernate search

**URL:** <https://discourse.hibernate.org/t/error-while-searching-with-unavailable-attribute-in-hibernate-search/6115>\
**Category:** Hibernate Search\
**Created:** [March 4, 2022, 10:42am UTC](https://discourse.hibernate.org/t/error-while-searching-with-unavailable-attribute-in-hibernate-search/6115 "2022-03-04T10:42:24Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [March 4, 2022, 1:54pm UTC](https://discourse.hibernate.org/t/error-while-searching-with-unavailable-attribute-in-hibernate-search/6115/8 "2022-03-04T13:54:03Z")

</div>

Hibernate Search 5 was not very strict, it used to accept any field even if it didn’t know about it (and then it would behave strangely, which is why we stopped doing that in 6).  
Also, Hibernate Search 5 would not handle dynamic fields explicitly, so most likely you were relying on Elasticsearch’s ability to automatically add fields it didn’t know about. And Elasticsearch adds a `keyword` sub-field by default in that case.

> [@Prashant\_Kamble](#):
>
> I need to remove `keyword` from all the below fields or need to use [native predicates](https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#search-dsl-predicate-extensions-elasticsearch-from-json) … Correct?

Correct.

EDIT: though if you don’t remove `keyword`, you’ll also need to find a way to define the `keyword` sub-field on `archetype.archetypeId`, `opsgenie.uuid`, etc. Your current Hibernate Search mapping doesn’t define the `keyword` sub-field, and due to how Hibernate Search 6 works, Elasticsearch won’t add it automatically like it did with Hibernate Search 5. Changing that might prove a bit difficult.

So to sum up, you’re better off removing `.keyword` 🙂

---

_[View the full topic](https://discourse.hibernate.org/t/error-while-searching-with-unavailable-attribute-in-hibernate-search/6115)._
