Hi.
I'd like to know if there's a way to use analyzed text when querying.
The specific requirement is to search for a matched string in 'term' field && the document's 'term_length' field should be less than equal to the length of the string which is analyzed when searching(by search_analyzer) .
This query works fine for not-analyzed string. Still, I couldn't find how to access analyzed query's length when querying or in script. (also searched for script API)
If there's any idea let me know how to do that, or if my explanation is not enough, please tell me.
Analysed text doesn't have a length. Analysers take the piece of text, filter out characters, generate tokens, filter tokens, and produce various data structures to allow you to query the text in various ways.
You can use a multi-field to store the analysed value in a text field, and the non-analysed value in a keyword field, then use the keyword field for getting the length.
I got one more question from your reply, for the part 'Analysed text doesn't have a length'.
It still has a size of tokens doesn't it? When I use analyze API the response is 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.