Elasticsearch version (bin/elasticsearch --version): 7.7
Plugins installed: [analysis-kuromoji]
Description of the problem including expected versus actual behavior:
When min length is set to 2 for length filter, I found there will be some cases which can not be highlighted properly. After taking a further look, seems _analyze call of query and query validate call give different tokens.
Steps to reproduce:
Example 1: Set min:2 for length token filter. Failed to highlight
Create mapping & document:
Elasticsearch version (
bin/elasticsearch --version
): 7.7Plugins installed: [analysis-kuromoji]
Description of the problem including expected versus actual behavior: When min length is set to 2 for length filter, I found there will be some cases which can not be highlighted properly. After taking a further look, seems _analyze call of query and query validate call give different tokens.
Steps to reproduce:
Example 1: Set min:2 for length token filter. Failed to highlight Create mapping & document:
Run query:
Results:
For this case,
昭和53
is also expected to be highlighted.Example 2: Set min:1 for length token filter. Highlighted as expected Create mapping & document:
Run query:
Results:
Since all tokens will be kept, it highlights all as expected.
With length=2, we get the following tokens from an
_analyze
call:This should produce a boolean query that looks something like
message:(昭和 53) OR message:1978
. But the output of a query validate call gives this:The only term in the query is
1978
, and the other clause is not being generated.