span-first-query.asciidoc 608 B

123456789101112131415161718192021222324
  1. [[query-dsl-span-first-query]]
  2. === Span First Query
  3. Matches spans near the beginning of a field. The span first query maps
  4. to Lucene `SpanFirstQuery`. Here is an example:
  5. [source,js]
  6. --------------------------------------------------
  7. GET /_search
  8. {
  9. "query": {
  10. "span_first" : {
  11. "match" : {
  12. "span_term" : { "user" : "kimchy" }
  13. },
  14. "end" : 3
  15. }
  16. }
  17. }
  18. --------------------------------------------------
  19. // CONSOLE
  20. The `match` clause can be any other span type query. The `end` controls
  21. the maximum end position permitted in a match.