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

[BUG] - Elasticsearch v7 need to use track-total-hits to return the correct total count #85

Closed
xiaobeicn opened this issue Dec 30, 2021 · 4 comments
Assignees

Comments

@xiaobeicn
Copy link

reference

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-your-data.html#track-total-hits

@cars10
Copy link
Owner

cars10 commented Dec 30, 2021

Hi, can you please explain this issue in more detail? Are you aware that you can always edit the search query manually to include any options you like?

@xiaobeicn
Copy link
Author

I'm aware of custom search, but if the total number is more than 10,000, the statistics will always show up as 10,000 in the search results

The default search query

{
  "query": {
    "query_string": {
      "query": "*"
    }
  },
  "size": 10,
  "from": 0,
  "sort": []
}

It needs to be added for V7 track_total_hits

{
  "query": {
    "query_string": {
      "query": "*"
    }
  },
  "size": 10,
  "from": 0,
  "sort": [],
  "track_total_hits": true
}

@cars10
Copy link
Owner

cars10 commented Jan 9, 2022

track_total_hits does have performance implications though. But you are right, i think searching in elasticvue is not really performance critical, so i will add track_total_hits to the default query for now. Might be removed in the future if it causes trouble for some users, then you would have to add it manually to your search queries.

@cars10
Copy link
Owner

cars10 commented Feb 3, 2022

@xiaobeicn it seems like i have to revert this, sorry. track_total_hits is not supported on elasticsearch 2.x up to at least 5.x so this causes issues for many users. see #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants