term-query.asciidoc 822 B

12345678910111213141516171819202122232425262728293031
  1. [[query-dsl-term-query]]
  2. == Term Query
  3. Matches documents that have fields that contain a term (*not analyzed*).
  4. The term query maps to Lucene `TermQuery`. The following matches
  5. documents where the user field contains the term `kimchy`:
  6. [source,js]
  7. --------------------------------------------------
  8. {
  9. "term" : { "user" : "kimchy" }
  10. }
  11. --------------------------------------------------
  12. A boost can also be associated with the query:
  13. [source,js]
  14. --------------------------------------------------
  15. {
  16. "term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } }
  17. }
  18. --------------------------------------------------
  19. Or :
  20. [source,js]
  21. --------------------------------------------------
  22. {
  23. "term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
  24. }
  25. --------------------------------------------------