Skip to content
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

searchPagination won't work in ES > 7.0 #96

Open
pszafer opened this issue Mar 4, 2020 · 1 comment
Open

searchPagination won't work in ES > 7.0 #96

pszafer opened this issue Mar 4, 2020 · 1 comment

Comments

@pszafer
Copy link

pszafer commented Mar 4, 2020

There is breaking change in total hits so now graphql generates error:

Int cannot represent non-integer value: { value: 1364, relation: \"eq\" }"

I think this should be checked if it is object:

const itemCount = res.count || 0;

Here is link to this breaking change:

https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#hits-total-now-object-search-response

I think itemCount could be changed to something like this:

const itemCount = res.count.hasOwnProperty('value') && res.count.hasOwnProperty('relation') && res.count.relation == 'eq' ? res.count.value : res.count || 0;

Unfortunately this won't work if hits_total will be greater than 1000.
So maybe it would be better to set track_total_hits to true

pcasa added a commit to pcasa/graphql-compose-elasticsearch that referenced this issue Sep 16, 2020
@pcasa
Copy link
Contributor

pcasa commented Sep 16, 2020

@nodkz added a PR, I had a similar need.

pcasa added a commit to pcasa/graphql-compose-elasticsearch that referenced this issue Sep 16, 2020
pcasa added a commit to pcasa/graphql-compose-elasticsearch that referenced this issue Sep 16, 2020
pcasa added a commit to pcasa/graphql-compose-elasticsearch that referenced this issue Sep 16, 2020
nodkz pushed a commit that referenced this issue Sep 16, 2020
* #96: check if ES7+ for hits count

* #96: fix typo

* #96: add optional chain polyfill

* #96: fix prettier lint issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants