Elasticsearch query to return documents with similar field values

Hi,

Elasticsearch version: 7.3.1

I have a requirement where i need to fetch documents which has similar values for some fields. For ex, say:

doc1: {'a': 1, 'b': 2, 'c': 3}
doc2: {'a': 4, 'b': 5, 'c': 6}
doc3: {'a': 1, 'b': 5, 'c': 3}

So is there a way to get documents which have same values for field 'a' and 'c'? (In this case have to return only doc1 and doc3)

In general, Is there a way to write a query to return documents only if some other document have same values for some fields.?

NOTE: I can write a wrapper script to fetch all the documents first and filter them based on the similarity of the values of some keys. But since my documents are really large, fetching all the documents from elasticsearch is taking too much time and I really don't want to increase the timeout too much. So i want to do much of the filtering on elasticsearch side itself.

Thanks

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