The documentation on prefix queries states: "Matches documents that have fields containing terms with a specified prefix (not analyzed)".
I took this to mean that the mapping for the field had to be not_analized. However, after some experimentation, I found that it does sort of work on an analysed field, but the query is not analysed. Eg. I found I could use a custom analyser on the field that uses a keyword tokenizer and a lowercase token filter and, so long as I lower case the query string myself, I can use a prefix query to get a case insensitive prefix match.
So I am wondering if this is valid and, if so, am I alone in thinking the documentation is misleading? Perhaps it should state that the query is not analysed and to take care when matching on an analysed field?
The documentation on prefix queries states: "Matches documents that have fields containing terms with a specified prefix (not analyzed)".
I took this to mean that the mapping for the field had to be not_analized. However, after some experimentation, I found that it does sort of work on an analysed field, but the query is not analysed. Eg. I found I could use a custom analyser on the field that uses a keyword tokenizer and a lowercase token filter and, so long as I lower case the query string myself, I can use a prefix query to get a case insensitive prefix match.
So I am wondering if this is valid and, if so, am I alone in thinking the documentation is misleading? Perhaps it should state that the query is not analysed and to take care when matching on an analysed field?
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.