Description
🐛 Bug Report
This is outlined and briefly discussed here: elastic/elasticsearch#28806
I encountered the same issue and seeing how the above issue was closed due to "problem is not in es", I'm opening an issue here as IMO it is an issue with how the official elasticsearch js library handles this scenario.
To Reproduce
Query an index that includes documents which do not provide values for all fields.
{
"size":25,
"query":{
"bool":{
"must":[
{
"term":{
"someField1":"some-value"
}
},
]
}
},
"sort":[
{
"someSortField1":{
"order":"asc"
}
},
{
"someSortField2":{
"order":"asc"
}
},
],
}
Using the results of the above query, make a subsequent query providing a search_after
sort key based on one of the documents that did not provide values for all fields. For example:
{
"size":25,
"query":{
"bool":{
"must":[
{
"term":{
"someField1":"some-value"
}
},
]
}
},
"sort":[
{
"someSortField1":{
"order":"asc"
}
},
{
"someSortField2":{
"order":"asc"
}
},
],
"search_after":[
9223372036854776000,
"some-name",
]
}
Response from the above query indicates a illegal_state_exception "No matching token for number_type [BIG_INTEGER]"
Expected behavior
Ideally the js library handles this scenario without encountering the above issue. If that's not possible, at a minimum I would suggest calling out this limitation in the documentation and providing best practice guidance regarding any known workarounds for how to handle this scenario.
Your Environment
- node version: 8.10
@elastic/elasticsearch
version: ^7.4.0- os: Linux
- ES cluster version: 7.1