search.asciidoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [[search-search]]
  2. === Search
  3. The search API allows you to execute a search query and get back search hits
  4. that match the query. The query can either be provided using a simple
  5. <<search-uri-request,query string as a parameter>>, or using a
  6. <<search-request-body,request body>>.
  7. ["float",id="search-multi-index"]
  8. ==== Multi-Index
  9. All search APIs can be applied across multiple indices with support for
  10. the <<multi-index,multi index syntax>>. For
  11. example, we can search on all documents within the twitter index:
  12. [source,js]
  13. --------------------------------------------------
  14. GET /twitter/_search?q=user:kimchy
  15. --------------------------------------------------
  16. // CONSOLE
  17. // TEST[setup:twitter]
  18. We can also search all documents with a certain tag across several indices
  19. (for example, when there is one index per user):
  20. [source,js]
  21. --------------------------------------------------
  22. GET /kimchy,elasticsearch/_search?q=tag:wow
  23. --------------------------------------------------
  24. // CONSOLE
  25. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
  26. Or we can search across all available indices using `_all`:
  27. [source,js]
  28. ---------------------------------------------------
  29. GET /_all/_search?q=tag:wow
  30. ---------------------------------------------------
  31. // CONSOLE
  32. // TEST[setup:twitter]
  33. [float]
  34. [[search-partial-responses]]
  35. ==== Partial responses
  36. To ensure fast responses, the search API will respond with partial results if one or more shards fail. See <<shard-failures, Shard failures>> for more information.