get-search-application.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. [role="xpack"]
  2. [[get-search-application]]
  3. === Get Search Application
  4. beta::[]
  5. ++++
  6. <titleabbrev>Get Search Application</titleabbrev>
  7. ++++
  8. Retrieves information about a search application.
  9. If the search application has an inconsistent state between its alias and configured indices, a warning header will be returned with the response.
  10. To resolve this inconsistent state, issue an updated <<put-search-application>> command.
  11. [[get-search-application-request]]
  12. ==== {api-request-title}
  13. `GET _application/search_application/<name>`
  14. [[get-search-application-prereq]]
  15. ==== {api-prereq-title}
  16. Requires the `manage_search_application` cluster privilege.
  17. [[get-search-application-path-params]]
  18. ==== {api-path-parms-title}
  19. `<name>`::
  20. (Required, string)
  21. [[get-search-application-response-codes]]
  22. ==== {api-response-codes-title}
  23. `400`::
  24. The `name` was not provided.
  25. `404` (Missing resources)::
  26. No Search Application matching `name` could be found.
  27. [[get-search-application-example]]
  28. ==== {api-examples-title}
  29. The following example gets the Search Application named `my-app`:
  30. ////
  31. [source,console]
  32. --------------------------------------------------
  33. PUT index1
  34. PUT index2
  35. PUT _application/search_application/my-app
  36. {
  37. "indices": ["index1", "index2"],
  38. "updated_at_millis": 1682105622204,
  39. "template": {
  40. "script": {
  41. "source": {
  42. "query": {
  43. "query_string": {
  44. "query": "{{query_string}}",
  45. "default_field": "{{default_field}}"
  46. }
  47. }
  48. },
  49. "params": {
  50. "query_string": "*",
  51. "default_field": "*"
  52. }
  53. }
  54. }
  55. }
  56. --------------------------------------------------
  57. // TESTSETUP
  58. [source,console]
  59. --------------------------------------------------
  60. DELETE _application/search_application/my-app
  61. DELETE index1
  62. DELETE index2
  63. --------------------------------------------------
  64. // TEARDOWN
  65. ////
  66. [source,console]
  67. ----
  68. GET _application/search_application/my-app/
  69. ----
  70. A sample response:
  71. [source,console-result]
  72. ----
  73. {
  74. "name": "my-app",
  75. "updated_at_millis": 1682105622204,
  76. "template": {
  77. "script": {
  78. "source": {
  79. "query": {
  80. "query_string": {
  81. "query": "{{query_string}}",
  82. "default_field": "{{default_field}}"
  83. }
  84. }
  85. },
  86. "lang": "mustache",
  87. "options": {
  88. "content_type": "application/json;charset=utf-8"
  89. },
  90. "params": {
  91. "query_string": "*",
  92. "default_field": "*"
  93. }
  94. }
  95. }
  96. }
  97. ----
  98. // TESTRESPONSE[s/"updated_at_millis": 1682105622204/"updated_at_millis": $body.$_path/]
  99. [NOTE]
  100. ====
  101. The indices associated with a search application are not returned with the GET response.
  102. To view the indices, use the <<indices-get-alias, get alias>> API.
  103. The alias name will match the search application name, for example `my-app` in the example above.
  104. ====