pinned-query.asciidoc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[query-dsl-pinned-query]]
  4. === Pinned Query
  5. Promotes selected documents to rank higher than those matching a given query.
  6. This feature is typically used to guide searchers to curated documents that are
  7. promoted over and above any "organic" matches for a search.
  8. The promoted or "pinned" documents are identified using the document IDs stored in
  9. the <<mapping-id-field,`_id`>> field.
  10. ==== Example request
  11. [source,console]
  12. --------------------------------------------------
  13. GET /_search
  14. {
  15. "query": {
  16. "pinned" : {
  17. "ids" : ["1", "4", "100"],
  18. "organic" : {
  19. "match":{
  20. "description": "iphone"
  21. }
  22. }
  23. }
  24. }
  25. }
  26. --------------------------------------------------
  27. [[pinned-query-top-level-parameters]]
  28. ==== Top-level parameters for `pinned`
  29. `ids`::
  30. An array of <<mapping-id-field, document IDs>> listed in the order they are to appear in results.
  31. `organic`::
  32. Any choice of query used to rank documents which will be ranked below the "pinned" document ids.