Bool Query, multiple musts and json legality

json.org doesn't prevent from using the same name key in the same sequence
of (key, value) pairs. So I have tried (in sense) multiple musts

{
"query": {
"bool": {
"must": {
"term": { "someFlag": true }
},
"must": {
"range" : {
"someNumber" : {
"from" : 50000,
"to" : 2000000
}
}
},
"must": {
"match": { "someKey": "someString" }
}
},
"filtered": {
...
}
},
}

and ES responds as expected. OTOH, some developers (don't know why) guess
json object is similar to Map (i.e. there isn't duplicating keys). I just
want to be sure current (correct, to my mind) behavior is intentional and
will not change.

Accompanying question: is there another (probably more preferred) way to
AND queries?

--
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.

this should work too.

{
"query": {
"bool": {
"must": [
{
"term": { "someFlag": true }
},
{
"range" : {
"someNumber" : {
"from" : 50000,
"to" : 2000000
}
}
},
{
"match": { "someKey": "someString" }
}]
},
"filtered": {
...
}
},
}

On Wed, Jul 24, 2013 at 12:44 AM, Andrew Gaydenko <andrew.gaydenko@gmail.com

wrote:

json.org doesn't prevent from using the same name key in the same
sequence of (key, value) pairs. So I have tried (in sense) multiple musts

{
"query": {
"bool": {
"must": {
"term": { "someFlag": true }
},
"must": {
"range" : {
"someNumber" : {
"from" : 50000,
"to" : 2000000
}
}
},
"must": {
"match": { "someKey": "someString" }
}
},
"filtered": {
...
}
},
}

and ES responds as expected. OTOH, some developers (don't know why) guess
json object is similar to Map (i.e. there isn't duplicating keys). I just
want to be sure current (correct, to my mind) behavior is intentional and
will not change.

Accompanying question: is there another (probably more preferred) way to
AND queries?

--
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.

--
Perry | 彭琪
http://pengqi.me

--
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.

On Wednesday, July 24, 2013 5:22:18 AM UTC+4, Qi Peng wrote:

this should work too.

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