Help in forming multiple field filters


(arien) #1

Hi,

I am running the following query template for fetching filtered
results according to Field1,

{
"fields" : [ ],
"sort" : [
{ "Size" : {"order" : "asc"} }
],

"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "arien"
}
},
"filter" : {
"term" : {
"Field1" : "some_data1"
}
}
}
},
"highlight" : {
"order" : "score",
"fields" : {
"Content" : {"fragment_size" : 300, "number_of_fragments" : 15}
}
}
}

I want to provide two filters for getting those results such that
results of the query should filtered out with both those filters
simultaneously..lets say "Field2" : "some_data2".

I am trying to experiment this in different ways but somehow I always
ended up in illegal json exceptions or false results.So can someone
please suggest how to design this multiple field filter.
Thanks;
Arien


(Jan Fiedler) #2

If I read your requirements correctly, you are looking for an AND filter.
Find documentation including examples here:
http://www.elasticsearch.org/guide/reference/query-dsl/and-filter.html


(system) #3