Elasticsearch: the "title" field was indexed without position data; unable to start phrasequery

I have an index in ElasticSearch with the following display:

mappings: { feed: { properties: { html_url: { index: not_analyzed omit_norms: true index_options: docs type: string } title: { index_options: offsets type: string } created: { store: true format: yyyy-MM-dd HH:mm:ss type: date } description: { type: string } } } 

get the following error when performing a phrase search ("video games"):

IllegalStateException [field \ "title \" is indexed without position data; cannot start PhraseQuery (term = video)];

Searches for single words work fine. Tried "index_options: positions" but no luck. The header field contains text in several languages, sometimes empty. Interestingly, this seems to be a random case, for example, it failed with 200K or 800K documents using the same dataset. Is there a reason some headings will not be indexed with line items?

Elastic search version 0.90.5

+6
source share
2 answers

Just in case, someone has a different problem. There was another type / table (feed2) in the same index with the same "title" field, which was set to "not_analyzed".

For some reason, even if you specify the type: http://elasticsearchhost.com:9200/index_name/feed/_search , another type is still in search. Changing the display for type feed2 fixed the problem.

+4
source

You probably have another field called "title" with a different mapping of a different type , but in the same index.

Basically, if you have 2 fields with the same name in the same index - even if they are in different types - they cannot have different mappings: more precisely, even if they have the same ones (for example: "string"), but one of them is “analyzed” and the other is “not analyzed”, problems arise.

I mean, yes, you can try setting up 2 different comparisons, and ElasticSearch will not complain, but when you search, you will get a strange result, and everything will go for bananas.

You can read more about this problem here , where they say:

[...] In the end, we decided to apply the rule that all fields with the same name in the same index must have the same mapping [...]

And yes, given that ElasticSearch’s promise was always “it just works,” this small detail took many people by surprise.

+2
source

Source: https://habr.com/ru/post/955699/


All Articles