[[reference-search_application]]
== client.searchApplication

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////
++++
<style>
.lang-ts a.xref {
  text-decoration: underline !important;
}
</style>
++++


[discrete]
[[client.searchApplication.delete]]
== `client.searchApplication.delete()`

Delete a search application. Remove a search application and its associated alias. Indices attached to the search application are not removed.

{ref}/delete-search-application.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationDeleteRequest, options?: TransportRequestOptions) => Promise<SearchApplicationDeleteResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationDeleteRequest extends <<RequestBase>> {
  name: <<Name>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationDeleteResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.searchApplication.deleteBehavioralAnalytics]]
== `client.searchApplication.deleteBehavioralAnalytics()`

Delete a behavioral analytics collection. The associated data stream is also deleted.

{ref}/delete-analytics-collection.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions) => Promise<SearchApplicationDeleteBehavioralAnalyticsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationDeleteBehavioralAnalyticsRequest extends <<RequestBase>> {
  name: <<Name>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationDeleteBehavioralAnalyticsResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.searchApplication.get]]
== `client.searchApplication.get()`

Get search application details.

{ref}/get-search-application.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationGetRequest, options?: TransportRequestOptions) => Promise<SearchApplicationGetResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationGetRequest extends <<RequestBase>> {
  name: <<Name>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationGetResponse = <<SearchApplicationSearchApplication>>

----


[discrete]
[[client.searchApplication.getBehavioralAnalytics]]
== `client.searchApplication.getBehavioralAnalytics()`

Get behavioral analytics collections.

{ref}/list-analytics-collection.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions) => Promise<SearchApplicationGetBehavioralAnalyticsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationGetBehavioralAnalyticsRequest extends <<RequestBase>> {
  name?: <<Name>>[]
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationGetBehavioralAnalyticsResponse = Record<<<Name>>, <<SearchApplicationAnalyticsCollection>>>

----


[discrete]
[[client.searchApplication.list]]
== `client.searchApplication.list()`

Returns the existing search applications.

{ref}/list-search-applications.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationListRequest, options?: TransportRequestOptions) => Promise<SearchApplicationListResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationListRequest extends <<RequestBase>> {
  q?: string
  from?: <<integer>>
  size?: <<integer>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface SearchApplicationListResponse {
  count: <<long>>
  results: <<SearchApplicationSearchApplication>>[]
}

----


[discrete]
[[client.searchApplication.postBehavioralAnalyticsEvent]]
== `client.searchApplication.postBehavioralAnalyticsEvent()`

Creates a behavioral analytics event for existing collection.

http://todo.com/tbd[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationPostBehavioralAnalyticsEventRequest, options?: TransportRequestOptions) => Promise<SearchApplicationPostBehavioralAnalyticsEventResponse>
----

[discrete]
[[client.searchApplication.put]]
== `client.searchApplication.put()`

Create or update a search application.

{ref}/put-search-application.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationPutRequest, options?: TransportRequestOptions) => Promise<SearchApplicationPutResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationPutRequest extends <<RequestBase>> {
  name: <<Name>>
  create?: boolean
  search_application?: <<SearchApplicationSearchApplicationParameters>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface SearchApplicationPutResponse {
  result: <<Result>>
}

----


[discrete]
[[client.searchApplication.putBehavioralAnalytics]]
== `client.searchApplication.putBehavioralAnalytics()`

Create a behavioral analytics collection.

{ref}/put-analytics-collection.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions) => Promise<SearchApplicationPutBehavioralAnalyticsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationPutBehavioralAnalyticsRequest extends <<RequestBase>> {
  name: <<Name>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationPutBehavioralAnalyticsResponse = SearchApplicationPutBehavioralAnalyticsAnalyticsAcknowledgeResponseBase

----


[discrete]
[[client.searchApplication.renderQuery]]
== `client.searchApplication.renderQuery()`

Renders a query for given search application search parameters

{ref}/search-application-render-query.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationRenderQueryRequest, options?: TransportRequestOptions) => Promise<SearchApplicationRenderQueryResponse>
----

[discrete]
[[client.searchApplication.search]]
== `client.searchApplication.search()`

Run a search application search. Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. Unspecified template parameters are assigned their default values if applicable.

{ref}/search-application-search.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: SearchApplicationSearchRequest, options?: TransportRequestOptions) => Promise<SearchApplicationSearchResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface SearchApplicationSearchRequest extends <<RequestBase>> {
  name: <<Name>>
  typed_keys?: boolean
  params?: Record<string, any>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type SearchApplicationSearchResponse<TDocument = unknown, TAggregations = Record<<<AggregateName>>, <<AggregationsAggregate>>>> = <<SearchResponseBody>><TDocument, TAggregations>

----


