Open sachin-frayne opened 4 years ago
Pinging @elastic/es-search (:Search/Search)
To be fair this is documented (both in bool_prefix
multi-match query and match_bool_prefix
query):
The fuzziness, prefix_length, max_expansions, rewrite, and fuzzy_transpositions parameters are supported for the terms that are used to construct term queries, but do not have an effect on the prefix query constructed from the final term.
-- https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl-multi-match-query.html
The fuzziness, prefix_length, max_expansions, fuzzy_transpositions, and fuzzy_rewrite parameters can be applied to the term subqueries constructed for all terms but the final term. They do not have any effect on the prefix query constructed for the final term.
-- https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl-match-bool-prefix-query.html
But honestly I also don't understand this decision.
Want to voice my support for this as well. It'd be nice if there was an option to do a term match with fuzziness on the final term (in addition to the prefix query with an OR condition). Otherwise, search as you type doesn't find misspellings in the final term. It's most noticeable with single word queries, where misspellings are never found.
As a workaround I'm adding a space at the end of the search query, that way it does appear to apply fuzziness on the last word.
I'm not sure what the downsides of doing this are, I've just been experimenting on a test dataset and am reasonably happy with the results.
Pinging @elastic/es-search (Team:Search)
Pinging @elastic/es-search-relevance (Team:Search Relevance)
Elasticsearch version: 7.6.2
Describe the feature:
When I search in the fields created as part of the
search_as_you_type
dataType, I would like some fuzziness leniency, however I am not seeing this. See steps to reproduce below for full examples.TL;DR:
beraking
to match documents withbreaking
, via the standard field, with a fuzziness of 1 and abool_prefix
query type.berak
to matchbreaking
, via the_index_prefix
field, with a fuzziness of 1 and abool_prefix
query type.Steps to reproduce:
Additional Notes:
With query 1, it starts working when "type": "bool_query" is removed but then the
bool_query
nature is no longer preserved. i.e.