span-first-query.asciidoc 609 B

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