search.asciidoc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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]