Hi list,
Let's put I have a simple 'index' with a simple 'type' mapping animals like
this:
{
"name": "dog",
"type": "mammal"
}
{
"name": "dolphin",
"type": "mammal"
}
{
"name": "tiger",
"type": "mammal"
}
{
"name": "crocodile",
"type": "reptile"
}
{
"name": "lizard",
"type": "reptile"
}
Now I want to query something like (may make little sense, but it's the
concept what I'm trying to show here):
"Find all animals which are either mamals and its name starts with 'do', or
reptiles and its name ends with 'le'"
So analyzing this query, I need an OR with two conditions, each one also
with an AND inside:
OR {
{
AND {
"field": { "name": "do*" }
},
{
"term": { "type": "mammal" }
}
}
},
{
AND {
"field": { "name": "*le" }
},
{
"term": { "type": "reptile" }
}
}
}
}
Using a query I don't have AND/OR, but SHOULD; however, within SHOULD I
just cannot use an AND to force several criteria at a time.
On the other hand, if I use a filtered query, and use the AND/OR mechanism
from the filters, then I cannot use the 'field' query (or anything which
requires full-text search capabilities), as the filters do not provide such
functionality.
So what should I do? I'm afraid this is a very simple use case, but I'm
struggling to figure out the best way to handle it.
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.