I'm trying to perform a query to obtain all the indexed resources that have
a particular value for a property or do not have a value for that property.
It can be generalized to obtaining all the resources that have the value
for a property in a list of values or they do not have a value for that
property.
I tried to do it with filters but it didn't seem to work:
"query": {
"filtered" : {
"query" : {"match_all":{}},
"filter" : {
"or" : [
{ "term" : {"property":"value"}},
{"missing" : {"field":"property"}}
]
}
}
}
I also thought about bool-should queries but I do not know how to use the
missing filter in it.
Can anyone tell me why my query is wrong and how can I write a proper one?
I'm trying to perform a query to obtain all the indexed resources that
have a particular value for a property or do not have a value for that
property. It can be generalized to obtaining all the resources that have
the value for a property in a list of values or they do not have a value
for that property.
I tried to do it with filters but it didn't seem to work:
"query": {
"filtered" : {
"query" : {"match_all":{}},
"filter" : {
"or" : [
{ "term" : {"property":"value"}},
{"missing" : {"field":"property"}}
]
}
}
}
I also thought about bool-should queries but I do not know how to use the
missing filter in it.
Can anyone tell me why my query is wrong and how can I write a proper one?
Thanks Ivan. I thought I was getting incorrect results, but in fact
somebody else was indexing data at the same time.
On Wednesday, October 23, 2013 11:53:35 AM UTC+3, Iulia Pasov wrote:
Hello,
I'm trying to perform a query to obtain all the indexed resources that
have a particular value for a property or do not have a value for that
property. It can be generalized to obtaining all the resources that have
the value for a property in a list of values or they do not have a value
for that property.
I tried to do it with filters but it didn't seem to work:
"query": {
"filtered" : {
"query" : {"match_all":{}},
"filter" : {
"or" : [
{ "term" : {"property":"value"}},
{"missing" : {"field":"property"}}
]
}
}
}
I also thought about bool-should queries but I do not know how to use the
missing filter in it.
Can anyone tell me why my query is wrong and how can I write a proper one?
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.