Got it

The hits.total is incorrect during ES query.

686 0 11 0 3

Symptom:

When the same ES query statement queries the same index data at the same time, the number of hits.total values returned by the same index data is inconsistent (switch between 1 and 92).

Cause Analysis

1. This problem is a difficult problem in the ES community. Trouble ticket number: https://github.com/elastic/elasticsearch/issues/25603. This problem has remained in the ES community for nearly two years and has not been resolved yet.

2. The community provides two workarounds:

1) Specify the preference parameter during the query. _primary_first: The query operation is preferentially performed on the primary segment.

2) The sort parameter is added to the query request statement, which is sorted by a keyword field in the index.

3. Test the two workarounds on site.

1) The preference parameter cannot be completely avoided, and the problem still occurs. In addition, the query performance is affected in the case of high concurrency and large quantity.

2) Add the sort parameter. The query result is correct.

Solution:

Workaround: The sort parameter is added to the query request statement, which is sorted by keyword in the index

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.