-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix record skipping when querying paginated data across shards #3061
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"mappings" : { | ||
"properties" : { | ||
"key" : { | ||
"type" : "keyword" | ||
}, | ||
"num0" : { | ||
"type" : "double" | ||
}, | ||
"num1" : { | ||
"type" : "double" | ||
}, | ||
"num2" : { | ||
"type" : "double" | ||
}, | ||
"num3" : { | ||
"type" : "double" | ||
}, | ||
"num4" : { | ||
"type" : "double" | ||
}, | ||
"str0" : { | ||
"type" : "keyword" | ||
}, | ||
"str1" : { | ||
"type" : "keyword" | ||
}, | ||
"str2" : { | ||
"type" : "keyword" | ||
}, | ||
"str3" : { | ||
"type" : "keyword" | ||
}, | ||
"int0" : { | ||
"type" : "integer" | ||
}, | ||
"int1" : { | ||
"type" : "integer" | ||
}, | ||
"int2" : { | ||
"type" : "integer" | ||
}, | ||
"int3" : { | ||
"type" : "integer" | ||
}, | ||
"bool0" : { | ||
"type" : "boolean" | ||
}, | ||
"bool1" : { | ||
"type" : "boolean" | ||
}, | ||
"bool2" : { | ||
"type" : "boolean" | ||
}, | ||
"bool3" : { | ||
"type" : "boolean" | ||
}, | ||
"date0" : { | ||
"type" : "date", | ||
"format": "year_month_day" | ||
}, | ||
"date1" : { | ||
"type" : "date", | ||
"format": "year_month_day" | ||
}, | ||
"date2" : { | ||
"type" : "date", | ||
"format": "year_month_day" | ||
}, | ||
"date3" : { | ||
"type" : "date", | ||
"format": "year_month_day" | ||
}, | ||
"time0" : { | ||
"type" : "date", | ||
"format": "date_time_no_millis" | ||
}, | ||
"time1" : { | ||
"type" : "date", | ||
"format": "hour_minute_second" | ||
}, | ||
"datetime0" : { | ||
"type" : "date", | ||
"format": "date_time_no_millis" | ||
}, | ||
"datetime1" : { | ||
"type" : "date" | ||
}, | ||
"zzz" : { | ||
"type" : "keyword" | ||
} | ||
} | ||
}, | ||
"settings": { | ||
"index": { | ||
"number_of_shards": 4 | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,9 @@ public OpenSearchResponse searchWithPIT(Function<SearchRequest, SearchResponse> | |
// Set sort field for search_after | ||
if (this.sourceBuilder.sorts() == null) { | ||
this.sourceBuilder.sort(DOC_FIELD_NAME, ASC); | ||
// Workaround to preserve sort location more exactly, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is workaround, could u add the long-term solution issue? |
||
// see https://github.com/opensearch-project/sql/pull/3061 | ||
this.sourceBuilder.sort("_id", ASC); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see there are a couple places in the code where we sort on doc field. https://github.com/search?q=repo%3Aopensearch-project%2Fsql+%22DOC_FIELD_NAME%22&type=code |
||
} | ||
SearchRequest searchRequest = new SearchRequest().source(this.sourceBuilder); | ||
this.searchResponse = searchAction.apply(searchRequest); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.