pinned-query.asciidoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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,js]
  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. // CONSOLE
  28. [[pinned-query-top-level-parameters]]
  29. ==== Top-level parameters for `pinned`
  30. `ids`::
  31. An array of <<mapping-id-field, document IDs>> listed in the order they are to appear in results.
  32. `organic`::
  33. Any choice of query used to rank documents which will be ranked below the "pinned" document ids.