2015-05-05 02:27:52 -04:00
|
|
|
[[query-dsl-and-query]]
|
|
|
|
== And Query
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2015-05-05 02:27:52 -04:00
|
|
|
deprecated[2.0.0, Use the `bool` query instead]
|
2015-04-09 12:33:27 -04:00
|
|
|
|
2015-05-05 02:27:52 -04:00
|
|
|
A query that matches documents using the `AND` boolean operator on other
|
|
|
|
queries.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"filtered" : {
|
|
|
|
"query" : {
|
|
|
|
"term" : { "name.first" : "shay" }
|
|
|
|
},
|
|
|
|
"filter" : {
|
|
|
|
"and" : [
|
|
|
|
{
|
|
|
|
"range" : {
|
|
|
|
"postDate" : {
|
|
|
|
"from" : "2010-03-01",
|
|
|
|
"to" : "2010-04-01"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"prefix" : { "name.second" : "ba" }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|