Diff query between two documents


(guy) #1

Hi,
say I have a type that is modeled in the following way:

document {
id: x,
nested_object: [
{objects}, {objects}...
] }

I am looking for a way to execute a diff query between two documents of this type, so that the diff will return all the inner nested objects that exist in one of the documents, but do not exist in the other one..

is it possible ?
if so - do I have a way for controlling the equals function for comparing two nested documents?


(Jaspreet Singh) #2

Im not sure if you can diff, but the exists API will let you find out missing, null or empty objects in absolute terms. Take a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html


(guy) #3

thanks for the comment, but this query is not suitable in my case.
I need a more advance diff to find out nested objects that some of their field values are different..