list-search-applications.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. [role="xpack"]
  2. [[list-search-applications]]
  3. === List Search Applications
  4. beta::[]
  5. ++++
  6. <titleabbrev>List Search Applications</titleabbrev>
  7. ++++
  8. Returns information about Search Applications.
  9. [[list-search-applications-request]]
  10. ==== {api-request-title}
  11. `GET _application/search_application/`
  12. [[list-search-applications-prereq]]
  13. ==== {api-prereq-title}
  14. Requires the `manage_search_application` cluster privilege.
  15. [[list-search-applications-path-params]]
  16. ==== {api-path-parms-title}
  17. `q`::
  18. (Optional, string) Query in the Lucene query string syntax, to return only search applications matching the query.
  19. `size`::
  20. (Optional, integer) Maximum number of results to retrieve.
  21. `from`::
  22. (Optional, integer) The offset from the first result to fetch.
  23. [[list-search-applications-response-codes]]
  24. ==== {api-response-codes-title}
  25. [[list-search-applications-example]]
  26. ==== {api-examples-title}
  27. The following example lists all configured search applications:
  28. ////
  29. [source,console]
  30. --------------------------------------------------
  31. PUT index1
  32. PUT _application/search_application/app-1
  33. {
  34. "indices": [ "index1" ],
  35. "template": {
  36. "script": {
  37. "source": {
  38. "query": {
  39. "query_string": {
  40. "query": "{{query_string}}"
  41. }
  42. }
  43. }
  44. }
  45. }
  46. }
  47. PUT _application/search_application/app-2
  48. {
  49. "indices": [ "index1" ],
  50. "template": {
  51. "script": {
  52. "source": {
  53. "query": {
  54. "query_string": {
  55. "query": "{{query_string}}"
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. --------------------------------------------------
  63. // TESTSETUP
  64. [source,console]
  65. --------------------------------------------------
  66. DELETE _application/search_application/app-1
  67. DELETE _application/search_application/app-2
  68. --------------------------------------------------
  69. // TEARDOWN
  70. ////
  71. [source,console]
  72. ----
  73. GET _application/search_application/
  74. ----
  75. The following example queries the first three search applications whose names start with `app`:
  76. [source,console]
  77. ----
  78. GET _application/search_application?from=0&size=3&q=app*
  79. ----
  80. A sample response:
  81. [source,console-result]
  82. ----
  83. {
  84. "count": 2,
  85. "results": [
  86. {
  87. "name": "app-1",
  88. "updated_at_millis": 1690981129366
  89. },
  90. {
  91. "name": "app-2",
  92. "updated_at_millis": 1691501823939
  93. }
  94. ]
  95. }
  96. ----
  97. // TESTRESPONSE[s/"updated_at_millis": 1690981129366/"updated_at_millis": $body.$_path/]
  98. // TESTRESPONSE[s/"updated_at_millis": 1691501823939/"updated_at_millis": $body.$_path/]