elasticsearch/docs/reference/search-application/apis/get-search-application.asciidoc
Saikat Sarkar c9a2555f09
[Search Relevance] GET search application API should return the alias indices (#99029)
* Add indices to GET search_application endpoint

* Update x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/search/SearchApplication.java

Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>

* Update x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/search/SearchApplication.java

Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>

* Update x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/search/SearchApplication.java

Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>

* Add indices to GET search_application endpoint

---------

Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>
2023-09-04 16:43:38 -06:00

129 lines
2.6 KiB
Text

[role="xpack"]
[[get-search-application]]
=== Get Search Application
beta::[]
++++
<titleabbrev>Get Search Application</titleabbrev>
++++
Retrieves information about a search application.
[[get-search-application-request]]
==== {api-request-title}
`GET _application/search_application/<name>`
[[get-search-application-prereq]]
==== {api-prereq-title}
Requires the `manage_search_application` cluster privilege.
[[get-search-application-path-params]]
==== {api-path-parms-title}
`<name>`::
(Required, string)
[[get-search-application-response-codes]]
==== {api-response-codes-title}
`400`::
The `name` was not provided.
`404` (Missing resources)::
No Search Application matching `name` could be found.
[[get-search-application-example]]
==== {api-examples-title}
The following example gets the Search Application named `my-app`:
////
[source,console]
--------------------------------------------------
PUT index1
PUT index2
PUT _application/search_application/my-app
{
"indices": ["index1", "index2"],
"updated_at_millis": 1682105622204,
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}",
"default_field": "{{default_field}}"
}
}
},
"params": {
"query_string": "*",
"default_field": "*"
}
}
}
}
--------------------------------------------------
// TESTSETUP
[source,console]
--------------------------------------------------
DELETE _application/search_application/my-app
DELETE index1
DELETE index2
--------------------------------------------------
// TEARDOWN
////
[source,console]
----
GET _application/search_application/my-app/
----
A sample response:
[source,console-result]
----
{
"name": "my-app",
"indices": [ "index1", "index2" ],
"updated_at_millis": 1682105622204,
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}",
"default_field": "{{default_field}}"
}
}
},
"lang": "mustache",
"options": {
"content_type": "application/json;charset=utf-8"
},
"params": {
"query_string": "*",
"default_field": "*"
}
}
}
}
----
// TESTRESPONSE[s/"updated_at_millis": 1682105622204/"updated_at_millis": $body.$_path/]
[NOTE]
====
The indices associated with a search application are not returned with the GET response.
To view the indices, use the <<indices-get-alias, get alias>> API.
The alias name will match the search application name, for example `my-app` in the example above.
====