span-term-query.asciidoc 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [[query-dsl-span-term-query]]
  2. === Span term query
  3. ++++
  4. <titleabbrev>Span term</titleabbrev>
  5. ++++
  6. Matches spans containing a term. The span term query maps to Lucene
  7. `SpanTermQuery`. Here is an example:
  8. [source,console]
  9. --------------------------------------------------
  10. GET /_search
  11. {
  12. "query": {
  13. "span_term" : { "user" : "kimchy" }
  14. }
  15. }
  16. --------------------------------------------------
  17. A boost can also be associated with the query:
  18. [source,console]
  19. --------------------------------------------------
  20. GET /_search
  21. {
  22. "query": {
  23. "span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } }
  24. }
  25. }
  26. --------------------------------------------------
  27. Or :
  28. [source,console]
  29. --------------------------------------------------
  30. GET /_search
  31. {
  32. "query": {
  33. "span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
  34. }
  35. }
  36. --------------------------------------------------