Just starting with ElasticSearch and am a bit tentative. Did study the
guide, but have a few questions about what can get nested where, so please
bear with me.
I need to AND numerous criteria (dynamically according to user entry). I
presume that "must" under bool is like "and" under filter? If so, the
example below will AND the elements of criteria:
{
"bool":
{
"must":[
{"query_string":
{"query": "myStuff", "allow_leading_wildcard": true,
"phrase_slop": 0}
},
{"term": {"lastName":"Smith"}},
{"range":{"age":{"from":"10", "to":"20"}}}
]
}
}
The thing I would like to AND to the above structure is/are additional
RANGE queries, which themselves have OR'd criteria. Can I effectively OR
RANGE criteria like this?:
{
"range" : {
"age" : {
"from" : 10,
"to" : 20
}
"age" : {
"from" : 30,
"to" : 40
}
}
}
Then AND that block to the "must" array in the 1st structure. Will
ElasticSearch find indexes for multiple age ranges in this case from this
syntax? Is there a better way? Thanks.