and-query.asciidoc 809 B

12345678910111213141516171819202122232425262728293031323334
  1. [[query-dsl-and-query]]
  2. === And Query
  3. deprecated[2.0.0, Use the `bool` query instead]
  4. A query that matches documents using the `AND` boolean operator on other
  5. queries.
  6. [source,js]
  7. --------------------------------------------------
  8. {
  9. "filtered" : {
  10. "query" : {
  11. "term" : { "name.first" : "shay" }
  12. },
  13. "filter" : {
  14. "and" : [
  15. {
  16. "range" : {
  17. "postDate" : {
  18. "from" : "2010-03-01",
  19. "to" : "2010-04-01"
  20. }
  21. }
  22. },
  23. {
  24. "prefix" : { "name.second" : "ba" }
  25. }
  26. ]
  27. }
  28. }
  29. }
  30. --------------------------------------------------