How to query a multi-value field?

For example, I have a field which can have multiple value:
{ "areaId" : [12, 45, 86, 92, 10] }

If I want to index documents whose "areaId" field contains 92, or contains
92 and 10, what is the best approach?
Thanks.

--
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/ce7d61fc-21dd-4355-8d3f-d03bcb54902d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Index your document as you have it, then you can query it as follows:

curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"areaId": 92
}
},
{
"term": {
"areaId": 10
}
}
]
}
}
}
}
}'

On 3 December 2013 08:26, Daniel Guo daniel5hbs@gmail.com wrote:

For example, I have a field which can have multiple value:
{ "areaId" : [12, 45, 86, 92, 10] }

If I want to index documents whose "areaId" field contains 92, or contains
92 and 10, what is the best approach?
Thanks.

--
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/ce7d61fc-21dd-4355-8d3f-d03bcb54902d%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CAPt3XKRbsiEoN%2BENKu5%2BJvADzzGEOcC5CDauDG7Pogn3wk5J8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Clinton:
It does work, thank you!

On Tuesday, December 3, 2013 3:43:24 PM UTC+8, Clinton Gormley wrote:

Index your document as you have it, then you can query it as follows:

curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"areaId": 92
}
},
{
"term": {
"areaId": 10
}
}
]
}
}
}
}
}'

On 3 December 2013 08:26, Daniel Guo <danie...@gmail.com <javascript:>>wrote:

For example, I have a field which can have multiple value:
{ "areaId" : [12, 45, 86, 92, 10] }

If I want to index documents whose "areaId" field contains 92, or
contains 92 and 10, what is the best approach?
Thanks.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ce7d61fc-21dd-4355-8d3f-d03bcb54902d%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/c3ab53a9-b31f-44ec-8834-b80f01ea796e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.