I need to query parent which has not child attach to it


(Ayache Khettar) #1

Hi

The below query search for all entries in a index which has child with the
given stepUUID. I am interested to search for all entries which don't have
child item populated yet. I was looking at using 'must_not" but not sure
how to construct the query. Your help is very much appreciated.

Regards,

akhettar

{
"query": {
"match": {
"stepUUID": "fd7a5c5d-5254-4941-9c8a-e19a39be86b0"
}
},
"filter": {
"has_child": {
"type": "redelivery",
"query" : {
"match": {
"stepUUID": {
"query" : "fd7a5c5d-5254-4941-9c8a-e19a39be86b0",
"operator" : "and"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b02a052c-bb25-432a-abd1-aae8f77cac15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ayache Khettar) #2

Hi

I am replying to my query I sent last week for the benefit of all. Here is
the answer:

{
"query": {
"match": {"status" : "ERROR"}
},
"filter": {
"not":{
"filter":{
"has_child": {
"type": "redelivery",
"query" : {
"match_all": {}
}
}
}
}
}
}
}

All the best

Ayache

On Monday, June 16, 2014 2:25:07 PM UTC+1, Ayache Khettar wrote:

Hi

The below query search for all entries in a index which has child with the
given stepUUID. I am interested to search for all entries which don't have
child item populated yet. I was looking at using 'must_not" but not sure
how to construct the query. Your help is very much appreciated.

Regards,

akhettar

{
"query": {
"match": {
"stepUUID": "fd7a5c5d-5254-4941-9c8a-e19a39be86b0"
}
},
"filter": {
"has_child": {
"type": "redelivery",
"query" : {
"match": {
"stepUUID": {
"query" : "fd7a5c5d-5254-4941-9c8a-e19a39be86b0",
"operator" : "and"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2656ef48-ce23-442e-b440-1a3d39ea0494%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3