Querying docs array type elemnts with multiple fields

I have the following 2 docs in the index:

curl -XPUT 'http://localhost:9200/tweet/100' -d '{
"tweet" : {
"message" : "some arrays in this tweet...",
"lists" : [
{
"name" : "prog_list",
"description" : "programming list",
"labels" : ["maybe","fine"]
},
{
"name" : "cool_list",
"description" : "cool stuff list",
"labels" : ["good","nice"]
}
]
}
}'

curl -XPUT 'http://localhost:9200/tweet/200' -d '{
"tweet" : {
"message" : "some arrays in this tweet...",
"lists" : [
{
"name" : "prog_list",
"description" : "programming list",
"labels" : ["good","nice"]
},
{
"name" : "cool_list",
"description" : "cool stuff list",
"labels" : ["pos","neg"]
}
]
}
}'

Now I like to return only the docs that have an array element of type lists
with name=prog_list and labels has "good" i.e. doc 200 above.
but the following query returns both docs:

{
"query": {
"bool": {
"should": [
{
"term": {
"name": "prog_list"
}
},
{
"term": {
"labels": "good"
}
}
],
"minimum_should_match": 2
}
}
}

Is there a way we can apply the the above query to the same lists element?

Thanks!
Pavan

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Seems like nested mapping is the only way we can avoid cross obj search.

Something we cannot afford to do given the voulme of nested docs that will
be created for each doc.

On Monday, 29 July 2013 11:22:21 UTC-7, pavan achanta wrote:

I have the following 2 docs in the index:

curl -XPUT 'http://localhost:9200/tweet/100' -d '{
"tweet" : {
"message" : "some arrays in this tweet...",
"lists" : [
{
"name" : "prog_list",
"description" : "programming list",
"labels" : ["maybe","fine"]
},
{
"name" : "cool_list",
"description" : "cool stuff list",
"labels" : ["good","nice"]
}
]
}
}'

curl -XPUT 'http://localhost:9200/tweet/200' -d '{
"tweet" : {
"message" : "some arrays in this tweet...",
"lists" : [
{
"name" : "prog_list",
"description" : "programming list",
"labels" : ["good","nice"]
},
{
"name" : "cool_list",
"description" : "cool stuff list",
"labels" : ["pos","neg"]
}
]
}
}'

Now I like to return only the docs that have an array element of type
lists with name=prog_list and labels has "good" i.e. doc 200 above.
but the following query returns both docs:

{
"query": {
"bool": {
"should": [
{
"term": {
"name": "prog_list"
}
},
{
"term": {
"labels": "good"
}
}
],
"minimum_should_match": 2
}
}
}

Is there a way we can apply the the above query to the same lists element?

Thanks!
Pavan

--
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.
For more options, visit https://groups.google.com/groups/opt_out.