Document has filter sub-document with fields to be searched
{
customField1: customFieldValue1,
...
// Fields to be filtered
filter : {
firstFieldName: firstFieldValue,
secondFieldName: secondFieldValue,
}
}
I need to search for exact values within filter fields with OR - operator.
As I mentioned for exact-value searches, probably filter is the best option
instead of a query, as a filter will be cached.
But I am not sure
This search request filters only firstFieldValue properly
POST /index/type/_search
{
"filter": {
"bool": {
"must": [
{
"term": {
"filter.firstFieldName": "firstFieldValue"
}
},
{
"term": {
"filter.secondFieldName": "secondFieldValue"
}
},
]
}
}
}
And query matching works properly:
POST /index/type/_search
{
"query": {
"match": {
"firstFieldName": "firstFieldValue"
}
}
}
why?
--
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/c43fe35b-09f3-41b1-811a-5bf4bb1d43e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.