Query sometimes result smaller than it should be

Hi, I'm a beginner of Elasticsearch and trying to count documents in an index.
But I faced a situation that does not fit my intuition.

  • I'm using Elasticsearch 6.4.
  • my elasticsearch index has 10 documents.
  • every document has the form {"type":"foo", "variableProp":1}.
    • where "type" is one of "foo" "bar" "baz", and "variableProp" varies.
  • my process updates "variableProp" in these documents every second.
    • using Bulk API specifying 'index' actions.
    • it does not change the "type".
  • another process queries the index every 5 seconds.
    • aggregating by "type" term and count each type of document.

I expect the query produces the same result every time and the sum of each counts to be 10, but sometimes it results 9 or 8 or more smaller.
It seems they will not be larger than it should be, but can be smaller.

Can anyone explain this situation?
Is there a way to avoid the decreasing counts?

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