I have been facing issues related to es response order which is getting reshuffled even though I am not querying on the fields (I have made them non-indexed so as to ignore them in scoring) and performing dfs_query_then_fetch query. Moreover, those non-indexed fields are updated in every hit to elasticsearch.
Let's say there are 10 documents out of which 7 are indexed(by default) and remaining 3 are non-indexed (index: false), so now I am updating values to those non-indexed fields in each and every hit to es. At the same time, querying is happening over indexed fields as we can't query over non-indexed fields. Here comes the issue, for each query, the response order are not consistent, their order is getting changed even though the score is constant for the changed order (entity / doc).
Just to add, let's say there are 50 responses, out of which 20 have same scores, within that 20 responses, the orders are getting changed.
Even if the filters are used, all the docs have same scores, that way order is inconsistent. @Sriram8894 FYI
Let's say there are 10 fields inside a document out of which 7 fields are indexed(by default) and remaining 3 are non-indexed (index: false), so now I am updating values to those non-indexed fields in each and every hit to es. At the same time, querying is happening over indexed fields as we can't query over non-indexed fields. Here comes the issue, for each query, the response order are not consistent, their order is getting changed even though the score is constant for the changed order (entity / doc).
There is some basic misunderstanding here. All documents are indexed by definition. Within a document there are fields which may or may not be searchable. If you update a single field or put a complete new doc into the index it may or may not be immediately visible to a search, this depends upon the refresh setting. Elasticsearch is a non sql database and this loose connection between updates and searches is considered a strength, not a bug! Consider that sql requires the whole mechanism of transactions to tightly specify the coordination of updates with queries.
So, as mentioned earlier a worked example is best, from you, in order to help further.
Please provide a full example for reproduction including sample data, mappings and queries. It would also help if you showed the result you are getting with this sample data and highlight how this differs from what you expect/desire.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.