Refresh after update

I have some "refresh" problem with ElasticSearch v6.2.1.

Given an index "my_index" and a type "my_type", this is the scenario :

Step 1: Launch query that returns the 50 first documents where some fields (id, address, information) match with term parameter (e.g PARIS)

The result:


Step 2: Update DOC1 phoneNumber field with query (/my_index/my_type/DOC1/_update)

Step 3: Relaunch step 1 query.

The result:

DOC1 (29th place),

As we can see, my modified document is moved to the 29th place.
My question is why my document does not take the same place, knowing that phoneNumber is not considered in my search. Since the DOC1 is the most pertinent result.

I tried to refresh the index (/my_index/_refresh), to launch the refresh after update with "?refresh" (even if it's by default), to set "refresh_interval" to 1 second.
I tried to reduce number_of_replicas to 0 and number_of_shards to 1 with no result.

Any idea about this behavior, did I forget something?

The question is also asked in stackoverflow

Are you using a sort parameter?

No sort parameter, below the query :

	"from": 0,
	"size": 50,
	"query": {
		"bool": {
			"should": [{
				"query_string": {
					"query": "*PARIS*",
					"fields": [
					"type": "best_fields",
					"default_operator": "or",
					"max_determinized_states": 10000,
					"enable_position_increments": true,
					"fuzziness": "AUTO",
					"fuzzy_prefix_length": 0,
					"fuzzy_max_expansions": 50,
					"phrase_slop": 0,
					"analyze_wildcard": true,
					"escape": false,
					"auto_generate_synonyms_phrase_query": true,
					"fuzzy_transpositions": true,
					"boost": 1
			"adjust_pure_negative": true,
			"boost": 1
	"_source": {
		"includes": [
		"excludes": []

What are the _score of the documents? DOC2 and DOC1 in both cases?

All docs have the same _score : 1.2 :frowning:
That intrigues me too

As all scores are the same you can not rely on any specific position of one doc vs another.

I agree, so why at the first time, before the update the result is good and after the update it's going wrong ? Moreover, there is no reason to have the same score for all docs, anything wrong in the query ?

I don't think it's good or bad.
The score is just the same and because you are sorting by score, the result is correct.
You can sort by another field if you wish.

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