elasticsearch/docs/reference/search-application/apis/list-search-applications.asciidoc
Kathleen DeRusso 0437416c33
Tech debt: Add tests to documentation for query rules, search applications (#98266)
* Add tests for query rules

* More tests

* Fix search app tests

* Fix tests

* Add teardown to tests

* Add tests for list search apps call

* Update test in get search application

* Tweak stack trace

* Make response match in test

---------

Co-authored-by: carlosdelest <carlos.delgado@elastic.co>
2023-08-09 08:01:52 -04:00

124 lines
2.5 KiB
Text

[role="xpack"]
[[list-search-applications]]
=== List Search Applications
beta::[]
++++
<titleabbrev>List Search Applications</titleabbrev>
++++
Returns information about Search Applications.
[[list-search-applications-request]]
==== {api-request-title}
`GET _application/search_application/`
[[list-search-applications-prereq]]
==== {api-prereq-title}
Requires the `manage_search_application` cluster privilege.
[[list-search-applications-path-params]]
==== {api-path-parms-title}
`q`::
(Optional, string) Query in the Lucene query string syntax, to return only search applications matching the query.
`size`::
(Optional, integer) Maximum number of results to retrieve.
`from`::
(Optional, integer) The offset from the first result to fetch.
[[list-search-applications-response-codes]]
==== {api-response-codes-title}
[[list-search-applications-example]]
==== {api-examples-title}
The following example lists all configured search applications:
////
[source,console]
--------------------------------------------------
PUT index1
PUT _application/search_application/app-1
{
"indices": [ "index1" ],
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}"
}
}
}
}
}
}
PUT _application/search_application/app-2
{
"indices": [ "index1" ],
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}"
}
}
}
}
}
}
--------------------------------------------------
// TESTSETUP
[source,console]
--------------------------------------------------
DELETE _application/search_application/app-1
DELETE _application/search_application/app-2
--------------------------------------------------
// TEARDOWN
////
[source,console]
----
GET _application/search_application/
----
The following example queries the first three search applications whose names start with `app`:
[source,console]
----
GET _application/search_application?from=0&size=3&q=app*
----
A sample response:
[source,console-result]
----
{
"count": 2,
"results": [
{
"name": "app-1",
"updated_at_millis": 1690981129366
},
{
"name": "app-2",
"updated_at_millis": 1691501823939
}
]
}
----
// TESTRESPONSE[s/"updated_at_millis": 1690981129366/"updated_at_millis": $body.$_path/]
// TESTRESPONSE[s/"updated_at_millis": 1691501823939/"updated_at_millis": $body.$_path/]