Message Boards

Elastic Search problem: Fielddata is disabled on text fields by default...

G C, modified 3 Years ago.

Elastic Search problem: Fielddata is disabled on text fields by default...

New Member Posts: 8 Join Date: 10/8/20 Recent Posts

Hi, I have a feature inside my portlet that search a word inside folders and files on document and media library.

This is a piece of code:

                    SearchContext searchContext = new SearchContext();

.                        ....
                    Hits hits =FacetedSearcherManagerUtil.createFacetedSearcher().search(searchContext);

This is error stracktrace on search method:

2020-10-27 14:01:57.034 ERROR [http-nio-8080-exec-2][ElasticsearchIndexSearcher:165] java.lang.RuntimeException: org.elasticsearch.ElasticsearchStatusException: ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [assetTagNames] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [assetTagNames] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]];
java.lang.RuntimeException: org.elasticsearch.ElasticsearchStatusException: ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [assetTagNames] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [assetTagNames] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]];
    at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)     

"Reindex all search indexes" function from "Index Actions" is not a solution for this problem.

Anyone can help me?

Thanks

 

thumbnail
Prashant Ballal, modified 1 Year ago.

RE: Elastic Search problem: Fielddata is disabled on text fields by default...

New Member Posts: 9 Join Date: 1/19/22 Recent Posts

Have you found the solution for this? I am facing similer issue.

thumbnail
Russell Bohl, modified 1 Year ago.

RE: RE: Elastic Search problem: Fielddata is disabled on text fields by default...

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

Prashant, this is an old thread. You should post a new one with the details of your situation.

thumbnail
Russell Bohl, modified 1 Year ago.

RE: RE: Elastic Search problem: Fielddata is disabled on text fields by default...

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

As a stab in the dark, try using the .raw version of the text field. The original post references the assetTagNames field whose mapping looks like 

 

			"assetTagNames": {
				"fields": {
					"raw": {
						"store": true,
						"type": "keyword"
					}
				},
				"store": true,
				"term_vector": "with_positions_offsets",
				"type": "text"
			},

Refer to it as assetTagNames.raw and see if that helps.