using scroll to get all docs in elasticsearch but found the docs count not equals to the hits.count

Viewed 12

I'm writing a script to get all docs from elastcsearch by python3. the elasticsearch version is:

"version" : {
    "number" : "5.0.2",
    "build_hash" : "f6b4951",
    "build_date" : "2016-11-24T10:07:18.101Z",
    "build_snapshot" : false,
    "lucene_version" : "6.2.1"
  }

by using the function helpers.scan which from elasticsearch5 to scroll the elasticsearch, i've found the total count that the script executed is not equals to elasticsearch . there always got like hundreds mismatch. like:

script calculate:
total docs: 65511002

{
  "took": 200,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 65511233,

anyone can tell me what happend.

0 Answers
Related