match_bool_prefix not work expected. #85381
Labels
>bug
priority:normal
A label for assessing bug priority to be used by ES engineers
:Search Relevance/Analysis
How text is split into tokens
Team:Search Relevance
Meta label for the Search Relevance team in Elasticsearch
Elasticsearch version (bin/elasticsearch --version):
7.5.1
Description of the problem including expected versus actual behavior:
match_bool_prefix not work expected.
According the document, A match_bool_prefix query analyzes its input and constructs a bool query from the terms. Each term except the last is used in a term query. The last term is used in a prefix query.
but when i use match_bool_prefix, there are two situation seem not work like document says.
situation 1
I reproduce the problem by follows.
create test_index with title field
put a document
when i use match_bool_prefix saerch
document 1 has match
and the kibana search profiler shows it use MultiTermQuery and also expand to "docone"
but when i saerch it with "*" again
document 1 not match
and the kibana search profiler shows it not use prefix, just simple TermQuery with "doc".
if "*" already remove by standard analyzer, then two of those search should be same query. why second search does not use prefix query?
situation 2
After tokenizer, every token has a type (ex: ALPHANUM, word), whem i use third party tokenizer that will generate type not exist in elasticsearch, match_bool_prefix will not use prefix query for last term that has unknown type.
third party tokenizer: https://github.com/KennFalcon/elasticsearch-analysis-hanlp
I reproduce the problem by follows.
create test_index2 with title field that use third party tokenizer
put a document
analyzer result of "test docOne" and "doc"
the type "nx" is not exist in elasticsearch, so its match_bool_prefix will not use prefix query for last term of search "doc".
and the kibana search profiler shows it not use prefix, just simple TermQuery with "doc".
my problem is, Is there some filter condition inside match_bool_prefix?some condition make not exist type and "*" can not use prefix. i try to find those condition in source code, but not not found so far.
Problem only be reproduced when match_bool_prefix, use match_phrase_prefix are all work expected, thanks.
The text was updated successfully, but these errors were encountered: