-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
SearchSearch query, autocomplete ...etcSearch query, autocomplete ...etcbugSomething isn't workingSomething isn't workinglucene
Description
Describe the bug
Inconsistent field collapsing search results returned by cases of concurrent segment search enabled and disabled, and seems the result of the former case is not correct.
Related component
Search
To Reproduce
- Create index
curl -X PUT localhost:9201/abcd_test -H 'Content-Type: application/json' -d '{"settings":{"refresh_interval":"60s"}}'
- Index 3 documents into 3 segments
curl -XPOST "http://localhost:9201/abcd_test/_doc?refresh" -H 'Content-Type: application/json' -d'
{
"a":1,
"c":1,
"docIndex":1
}'
curl -XPOST "http://localhost:9201/abcd_test/_doc?refresh" -H 'Content-Type: application/json' -d'
{
"a":2,
"c":1,
"docIndex":2
}'
curl -XPOST "http://localhost:9201/abcd_test/_doc?refresh" -H 'Content-Type: application/json' -d'
{
"a":2,
"c":1,
"docIndex":3
}'
- Execute search
curl -XGET "http://localhost:9201/abcd_test/_search?size=2&request_cache=false" -H 'Content-Type: application/json' -d'
{
"collapse": {
"field": "a"
},
"sort":[{
"c":"desc"
}
]
}'
the result is
{"took":4027,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":3,"relation":"eq"},"max_score":null,"hits":[{"_index":"abcd_test","_id":"BymuwZgBMprIY4AAc-T_","_score":null,"_source":
{
"a":1,
"c":1,
"docIndex":1
},"fields":{"a":[1]},"sort":[1]},{"_index":"abcd_test","_id":"CCmuwZgBMprIY4AAdOSV","_score":null,"_source":
{
"a":2,
"c":1,
"docIndex":2
},"fields":{"a":[2]},"sort":[1]}]}}
- Enable concurrent segment search
curl -XPUT "http://localhost:9201/abcd_test/_settings" -H 'Content-Type: application/json' -d'
{
"index.search.concurrent_segment_search.mode": "all"
}'
- Execute the same query, check the result
{"took":147,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":3,"relation":"eq"},"max_score":null,"hits":[{"_index":"abcd_test","_id":"7qXpxpgBgVh_OsnfGh2r","_score":null,"_source":
{
"a":1,
"c":1,
"docIndex":1
},"fields":{"a":[1]},"sort":[1]},{"_index":"abcd_test","_id":"8KXpxpgBgVh_OsnfGx21","_score":null,"_source":
{
"a":2,
"c":1,
"docIndex":3
},"fields":{"a":[2]},"sort":[1]}]}}
, then you can see that the second doc is different from the above one.
I think the doc with docIndex 2 should be returned because this doc has small lucene doc id.
Expected behavior
When concurrent segment search enabled and executing field collapsing search, the result should be same to the result of the same query when concurrent segment search is disabled.
Additional Details
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [Main branch and 3.2]
Metadata
Metadata
Assignees
Labels
SearchSearch query, autocomplete ...etcSearch query, autocomplete ...etcbugSomething isn't workingSomething isn't workinglucene
Type
Projects
Status
🆕 New