I would like to perform a global search by providing a keyword like below (2 different requests) in the request. It returns the result which matches the word "pizza" in any of the field. But if I give "piz" in the request then it is not returning anything. Ultimately it expects complete word instead partial word. If I want to use any search string like "piz", may I know what do I need to do? Because when user performs global search then we can't expect exact word which matches. Please share your thoughts on this.
There are several ways to tackle this problem. You have to take balance between recall and precision. fuzziness option is a good start point. You can use fuzziness also in multi_match queries and query-string queries. If you want exact partial match, you can use n-gram analyzer or wildcard query with wildcard field.
Can you please share some examples if possible. That will be great. Because Fuzziness link which you have shared is not helping for my scenario, it seems it mentioned the field name called "message". But in my case, I do not want to mention the specific field name. It is completely global within index.
Yes, I used fuzziness like below. If I give "pizza" or "pizz" is working fine, but if I give"pi" then it is not returning any results. Fuzziness working partially.
Yes, that is what i said the balance between recall and precision. 'AUTO' allows one edit for 5 letter term. if you set "fusiness": 2, "piz" will match but "pi" will not. The advantage of fuzziness query is that can match something like "piza" or "pissa".
Again, another way is to use n-gram analyzer or wildcard query with wildcard 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.