Hi there,
I have observed inconsistency in the result for the below match_phrase_prefix query on elasticsearch 7.8.1.
QUERY:
{
"sort": [{
"created": {
"order": "desc"
}
}
],
"size": 10000,
"query": {
"bool": {
"should": [{
"match_phrase_prefix": {
"name": {
"query": "Trust",
"slop": 100,
"max_expansions": 50,
"boost": 1.0
}
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
} }
}
RESULTS
ELS v5.6.7
8910 - should -starts with Trust | max_expansion:50 | CORRECT RESULT
991 - must_not -Trust | max_expansion:50 | CORRECT RESULT
9901 - total doc countELS v7.8.1
250 - should -Trust | max_expansion:50 | WRONG RESULT
9651 - must_not -Trust | max_expansion:50 | WRONG RESULT
9901 - total doc count250 - should -Trust | max_expansion:500 | WRONG RESULT
7401 - must_not -Trust | max_expansion:500 | WRONG RESULT
9901 - total doc count8910 - should -Trust | max_expansion:5000 | CORRECT RESULT
991 - must_not -Trust | max_expansion:5000 | CORRECT RESULT
9901 - total doc count8910 - should -Trust | max_expansion:10000 | CORRECT RESULT
991 - must_not -Trust | max_expansion:10000 | CORRECT RESULT
9901 - total doc count8910 - should -starts with Trust | max_expansion:50 | CORRECT RESULT | after removing suffix analyzer
991 - must_not -Trust | max_expansion:50 | CORRECT RESULT | after removing suffix analyzer
9901 - total doc count
MAPPINGS on both versions is the same as below,
mappings {
Test {
"properties" {
"fullText" {
"type" "text"
}
"name" {
"type" "text"
"store" true
"fielddata" true
"copy_to" "fullText"
"fields" {
"raw" {
"type" "keyword"
}
"suffix" {
"type" "text"
"analyzer" "suffix_match_analyzer"
}
}
}
"created" { "type" "date" }
"dbId" {
"type" "long"
"copy_to" "fullText"
}
"empId" {
"type" "long"
"copy_to" "fullText"
}
"active" { "type" "boolean" }
"salary" { "type" "float" }
"category" { "type" "keyword" }
"sub-category" { "type" "keyword" }
"address" {
"type" "keyword"
"copy_to" "fullText"
"fields" {
"raw" {
"type" "ip"
"ignore_malformed" "true"
}
}
}
}
}
}
NOTE: It is seen that increasing max_expansion on V7.8.1 to a certain value returns the correct result.
For the same query and mappings, I'm getting the correct result on V5.6.7.
How do I get this result on V7.8.1?Do I need to update mappings or form a different query for V7.8.1?and if so why does it work on V5.6.7 and not on V7.8.1?
Thanks,
Animesh