I have a index created by a crawler and it creates a Title field, but when I'm trying to do a match_phrase_prefix search I have the error "failed to create query: field:[title] was indexed without position data; cannot run PhraseQuery" I read that it needs to be added the "position_increment_gap", but when I tried to add it in the mappings, there's no way, gets me the error :
Hi @freddyrb. The default mapping of the title field in a crawler index should support match_phrase_prefix queries. Can you try running a simple query and see if it works?
The problem is when I send more than one word, I want to search the documents that has in the title the "nuxeo drive" phrase, I don't want that Elastic search "nuxeo" and "drive" separated. Then I get the error.
Aha! Now, looking at the example you provided I understand the issue. Your default template mapping of search-testindex1 should already include a number of subfields for title property, that are indexed differently, to be suitable for a range of queries.
The stem subfield of title is indexed with position information. You can try running:
Also, you can always extend your existing mapping with a subfield or a new field. Here is an example of how to add a subfield called phrase to title property:
Thanks @Jedr_Blaszyk , I will see your suggestions, but my use case is a query with multiple indexes that have the field Title, and in all of them I have results (API Type) except in the Crawler index that throws the error.
Solution 2: Update mappings in other indices with same subfield e.g. title.stem (indexed with position data) and reindex the data. A bit more work for you, but resulting slightly better query time performance. In that way you would be able to run query like:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.