Sorting on missing values and using search_after

Elasticsearch Version 7.0.0
Node.js client
Node module: elasticsearch

Hi, I'm trying to fetch a set of documents from elasticsearch using the node.js client (node module: elasticsearch). The problem I'm running into is that when sorting based on some field (with data type long) that can have missing values, elasticsearch responds with a very large number 9223372036854775807 but for some reason, it gets converted into 9223372036854776000 (which is slightly larger) when using the node.js client. I wish to know:

  • Why is the number mutating?
  • Can this be handled somehow by tweaking some configuration in elasticsearch?
  • If not in elasticsearch, is there an elegant way to solve this within the node.js client?

Thank you.

Hey,

my non validated assumption: you might be hitting this javascript behaviour: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

I'll see if someone knows more about how to circumvent this than me :slight_smile:

--Alex

1 Like

Yes, I believe you're right and thanks I would really appreciate that.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.