-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Impossible to use search_after with null values #66242
Comments
Pinging @elastic/es-search (Team:Search) |
|
Hi @jimczi, Thanks for the response, but I'm not entirely following. Let's say I have the following 4 documents that I search one by one using search_after:
I want to sort them by lowest price first, then on the _id as a tie breaker, so I use the following sort:
The first result is fine:
So then I search_after price 1, id 100:
Which results in the next document:
So then I search_after price 2, id 200:
Which results in the next document:
But now what do I do? How would I use search_after with this to get to the document with ID 400? Because doing the following:
Results in a null_pointer_exception. |
Alright, I looked at the sort value in the response and figured it out. You can use Very unexpected and entirely undocumented, but I'm happy it works. Thanks a lot! |
@ozupey As Jim said, in |
Here are some more suggestions: Also if you use both ascending and descending I'd still like to have true |
Looks like the hack of using What's the alternative now? |
We found a solution, see opensearch-project/OpenSearch#1490 |
Elasticsearch version (
bin/elasticsearch --version
): 6.8.12Plugins installed: []
JVM version (
java -version
): openjdk version "1.8.0_275"OS version (
uname -a
if on a Unix-like system): Linux production 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 x86_64 x86_64 GNU/LinuxDescription of the problem including expected versus actual behavior:
It's impossible to use search_after with null values. Expected behavior is to make it possible.
Steps to reproduce:
Provide logs (if relevant):
As mentioned here:
https://discuss.elastic.co/t/search-after-and-nil-values/232246
If you happen to sort by a field that has a few null values, passing "null" or "nil" to search_after will result in an exception.
The text was updated successfully, but these errors were encountered: