Describe the feature:
Elasticsearch version (bin/elasticsearch --version):
6.2
Plugins installed: []
JVM version (java -version):
OS version (uname -a if on a Unix-like system):
Description of the problem including expected versus actual behavior:
I've got some query
{ type: 'Wandering',
zone: '1',
personName: 'Dmytro',
personRoom: 'Room_73' } }
And use wildcard and fuzziness with a query string, but looks like, when I type Wandring or wadnering , I expected fuzziness makes replacement.
'query': {
'query_string' : {
'query': `*${search}*~1 OR *${search}~1`,
'analyze_wildcard': true,
},
}
Provide logs (if relevant):
Pinging @elastic/es-search-aggs
The query_string cannot mix wildcards with fuzziness. You can search for wandring~1 but not wandring*~1. If you want to mix prefix search and fuzziness you can use the completion field in a suggest query or use an analyzer that builds all prefix/suffix of the terms at index time (https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-ngram-tokenizer.html) so that you can query an exact term (with fuzziness if needed) and get all suffixes/prefixes at query time.
Most helpful comment
The
query_stringcannot mix wildcards with fuzziness. You can search forwandring~1but notwandring*~1. If you want to mix prefix search and fuzziness you can use thecompletionfield in asuggestquery or use an analyzer that builds all prefix/suffix of the terms at index time (https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-ngram-tokenizer.html) so that you can query an exact term (with fuzziness if needed) and get all suffixes/prefixes at query time.