1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
|
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import typing as t
from elastic_transport import ObjectApiResponse
from ._base import NamespacedClient
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)
class FleetClient(NamespacedClient):
@_rewrite_parameters()
def global_checkpoints(
self,
*,
index: str,
checkpoints: t.Optional[t.Sequence[int]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
wait_for_advance: t.Optional[bool] = None,
wait_for_index: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html
<p>Get global checkpoints.</p>
<p>Get the current global checkpoints for an index.
This API is designed for internal use by the Fleet server project.</p>
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-fleet>`_
:param index: A single index or index alias that resolves to a single index.
:param checkpoints: A comma separated list of previous global checkpoints. When
used in combination with `wait_for_advance`, the API will only return once
the global checkpoints advances past the checkpoints. Providing an empty
list will cause Elasticsearch to immediately return the current global checkpoints.
:param timeout: Period to wait for a global checkpoints to advance past `checkpoints`.
:param wait_for_advance: A boolean value which controls whether to wait (until
the timeout) for the global checkpoints to advance past the provided `checkpoints`.
:param wait_for_index: A boolean value which controls whether to wait (until
the timeout) for the target index to exist and all primary shards be active.
Can only be true when `wait_for_advance` is true.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'index'")
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
__path = f'/{__path_parts["index"]}/_fleet/global_checkpoints'
__query: t.Dict[str, t.Any] = {}
if checkpoints is not None:
__query["checkpoints"] = checkpoints
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
if wait_for_advance is not None:
__query["wait_for_advance"] = wait_for_advance
if wait_for_index is not None:
__query["wait_for_index"] = wait_for_index
__headers = {"accept": "application/json"}
return self.perform_request( # type: ignore[return-value]
"GET",
__path,
params=__query,
headers=__headers,
endpoint_id="fleet.global_checkpoints",
path_parts=__path_parts,
)
@_rewrite_parameters(
body_name="searches",
)
@_stability_warning(Stability.EXPERIMENTAL)
def msearch(
self,
*,
searches: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
body: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
index: t.Optional[str] = None,
allow_no_indices: t.Optional[bool] = None,
allow_partial_search_results: t.Optional[bool] = None,
ccs_minimize_roundtrips: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
expand_wildcards: t.Optional[
t.Union[
t.Sequence[
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
],
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
]
] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
ignore_throttled: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
max_concurrent_searches: t.Optional[int] = None,
max_concurrent_shard_requests: t.Optional[int] = None,
pre_filter_shard_size: t.Optional[int] = None,
pretty: t.Optional[bool] = None,
rest_total_hits_as_int: t.Optional[bool] = None,
search_type: t.Optional[
t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
] = None,
typed_keys: t.Optional[bool] = None,
wait_for_checkpoints: t.Optional[t.Sequence[int]] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html
<p>Run multiple Fleet searches.
Run several Fleet searches with a single API request.
The API follows the same structure as the multi search API.
However, similar to the Fleet search API, it supports the <code>wait_for_checkpoints</code> parameter.</p>
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-fleet-msearch>`_
:param searches:
:param index: A single target to search. If the target is an index alias, it
must resolve to a single index.
:param allow_no_indices: If false, the request returns an error if any wildcard
expression, index alias, or _all value targets only missing or closed indices.
This behavior applies even if the request targets other open indices. For
example, a request targeting foo*,bar* returns an error if an index starts
with foo but no index starts with bar.
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param ccs_minimize_roundtrips: If true, network roundtrips between the coordinating
node and remote clusters are minimized for cross-cluster search requests.
:param expand_wildcards: Type of index that wildcard expressions can match. If
the request can target data streams, this argument determines whether wildcard
expressions match hidden data streams.
:param ignore_throttled: If true, concrete, expanded or aliased indices are ignored
when frozen.
:param ignore_unavailable: If true, missing or closed indices are not included
in the response.
:param max_concurrent_searches: Maximum number of concurrent searches the multi
search API can execute.
:param max_concurrent_shard_requests: Maximum number of concurrent shard requests
that each sub-search request executes per node.
:param pre_filter_shard_size: Defines a threshold that enforces a pre-filter
roundtrip to prefilter search shards based on query rewriting if the number
of shards the search request expands to exceeds the threshold. This filter
roundtrip can limit the number of shards significantly if for instance a
shard can not match any documents based on its rewrite method i.e., if date
filters are mandatory to match but the shard bounds and the query are disjoint.
:param rest_total_hits_as_int: If true, hits.total are returned as an integer
in the response. Defaults to false, which returns an object.
:param search_type: Indicates whether global term and document frequencies should
be used when scoring returned documents.
:param typed_keys: Specifies whether aggregation and suggester names should be
prefixed by their respective types in the response.
:param wait_for_checkpoints: A comma separated list of checkpoints. When configured,
the search API will only be executed on a shard after the relevant checkpoint
has become visible for search. Defaults to an empty list which will cause
Elasticsearch to immediately execute the search.
"""
if searches is None and body is None:
raise ValueError(
"Empty value passed for parameters 'searches' and 'body', one of them should be set."
)
elif searches is not None and body is not None:
raise ValueError("Cannot set both 'searches' and 'body'")
__path_parts: t.Dict[str, str]
if index not in SKIP_IN_PATH:
__path_parts = {"index": _quote(index)}
__path = f'/{__path_parts["index"]}/_fleet/_fleet_msearch'
else:
__path_parts = {}
__path = "/_fleet/_fleet_msearch"
__query: t.Dict[str, t.Any] = {}
if allow_no_indices is not None:
__query["allow_no_indices"] = allow_no_indices
if allow_partial_search_results is not None:
__query["allow_partial_search_results"] = allow_partial_search_results
if ccs_minimize_roundtrips is not None:
__query["ccs_minimize_roundtrips"] = ccs_minimize_roundtrips
if error_trace is not None:
__query["error_trace"] = error_trace
if expand_wildcards is not None:
__query["expand_wildcards"] = expand_wildcards
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if ignore_throttled is not None:
__query["ignore_throttled"] = ignore_throttled
if ignore_unavailable is not None:
__query["ignore_unavailable"] = ignore_unavailable
if max_concurrent_searches is not None:
__query["max_concurrent_searches"] = max_concurrent_searches
if max_concurrent_shard_requests is not None:
__query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
if pre_filter_shard_size is not None:
__query["pre_filter_shard_size"] = pre_filter_shard_size
if pretty is not None:
__query["pretty"] = pretty
if rest_total_hits_as_int is not None:
__query["rest_total_hits_as_int"] = rest_total_hits_as_int
if search_type is not None:
__query["search_type"] = search_type
if typed_keys is not None:
__query["typed_keys"] = typed_keys
if wait_for_checkpoints is not None:
__query["wait_for_checkpoints"] = wait_for_checkpoints
__body = searches if searches is not None else body
__headers = {
"accept": "application/json",
"content-type": "application/x-ndjson",
}
return self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="fleet.msearch",
path_parts=__path_parts,
)
@_rewrite_parameters(
body_fields=(
"aggregations",
"aggs",
"collapse",
"docvalue_fields",
"explain",
"ext",
"fields",
"from_",
"highlight",
"indices_boost",
"min_score",
"pit",
"post_filter",
"profile",
"query",
"rescore",
"runtime_mappings",
"script_fields",
"search_after",
"seq_no_primary_term",
"size",
"slice",
"sort",
"source",
"stats",
"stored_fields",
"suggest",
"terminate_after",
"timeout",
"track_scores",
"track_total_hits",
"version",
),
parameter_aliases={
"_source": "source",
"_source_excludes": "source_excludes",
"_source_includes": "source_includes",
"from": "from_",
},
)
@_stability_warning(Stability.EXPERIMENTAL)
def search(
self,
*,
index: str,
aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
allow_no_indices: t.Optional[bool] = None,
allow_partial_search_results: t.Optional[bool] = None,
analyze_wildcard: t.Optional[bool] = None,
analyzer: t.Optional[str] = None,
batched_reduce_size: t.Optional[int] = None,
ccs_minimize_roundtrips: t.Optional[bool] = None,
collapse: t.Optional[t.Mapping[str, t.Any]] = None,
default_operator: t.Optional[t.Union[str, t.Literal["and", "or"]]] = None,
df: t.Optional[str] = None,
docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
error_trace: t.Optional[bool] = None,
expand_wildcards: t.Optional[
t.Union[
t.Sequence[
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
],
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
]
] = None,
explain: t.Optional[bool] = None,
ext: t.Optional[t.Mapping[str, t.Any]] = None,
fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
from_: t.Optional[int] = None,
highlight: t.Optional[t.Mapping[str, t.Any]] = None,
human: t.Optional[bool] = None,
ignore_throttled: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
indices_boost: t.Optional[t.Sequence[t.Mapping[str, float]]] = None,
lenient: t.Optional[bool] = None,
max_concurrent_shard_requests: t.Optional[int] = None,
min_score: t.Optional[float] = None,
pit: t.Optional[t.Mapping[str, t.Any]] = None,
post_filter: t.Optional[t.Mapping[str, t.Any]] = None,
pre_filter_shard_size: t.Optional[int] = None,
preference: t.Optional[str] = None,
pretty: t.Optional[bool] = None,
profile: t.Optional[bool] = None,
q: t.Optional[str] = None,
query: t.Optional[t.Mapping[str, t.Any]] = None,
request_cache: t.Optional[bool] = None,
rescore: t.Optional[
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
] = None,
rest_total_hits_as_int: t.Optional[bool] = None,
routing: t.Optional[str] = None,
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
search_after: t.Optional[
t.Sequence[t.Union[None, bool, float, int, str]]
] = None,
search_type: t.Optional[
t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
] = None,
seq_no_primary_term: t.Optional[bool] = None,
size: t.Optional[int] = None,
slice: t.Optional[t.Mapping[str, t.Any]] = None,
sort: t.Optional[
t.Union[
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
t.Union[str, t.Mapping[str, t.Any]],
]
] = None,
source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
stats: t.Optional[t.Sequence[str]] = None,
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
suggest: t.Optional[t.Mapping[str, t.Any]] = None,
suggest_field: t.Optional[str] = None,
suggest_mode: t.Optional[
t.Union[str, t.Literal["always", "missing", "popular"]]
] = None,
suggest_size: t.Optional[int] = None,
suggest_text: t.Optional[str] = None,
terminate_after: t.Optional[int] = None,
timeout: t.Optional[str] = None,
track_scores: t.Optional[bool] = None,
track_total_hits: t.Optional[t.Union[bool, int]] = None,
typed_keys: t.Optional[bool] = None,
version: t.Optional[bool] = None,
wait_for_checkpoints: t.Optional[t.Sequence[int]] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html
<p>Run a Fleet search.
The purpose of the Fleet search API is to provide an API where the search will be run only
after the provided checkpoint has been processed and is visible for searches inside of Elasticsearch.</p>
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-fleet-search>`_
:param index: A single target to search. If the target is an index alias, it
must resolve to a single index.
:param aggregations:
:param aggs:
:param allow_no_indices:
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param analyze_wildcard:
:param analyzer:
:param batched_reduce_size:
:param ccs_minimize_roundtrips:
:param collapse:
:param default_operator:
:param df:
:param docvalue_fields: Array of wildcard (*) patterns. The request returns doc
values for field names matching these patterns in the hits.fields property
of the response.
:param expand_wildcards:
:param explain: If true, returns detailed information about score computation
as part of a hit.
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
:param fields: Array of wildcard (*) patterns. The request returns values for
field names matching these patterns in the hits.fields property of the response.
:param from_: Starting document offset. By default, you cannot page through more
than 10,000 hits using the from and size parameters. To page through more
hits, use the search_after parameter.
:param highlight:
:param ignore_throttled:
:param ignore_unavailable:
:param indices_boost: Boosts the _score of documents from specified indices.
:param lenient:
:param max_concurrent_shard_requests:
:param min_score: Minimum _score for matching documents. Documents with a lower
_score are not included in search results and results collected by aggregations.
:param pit: Limits the search to a point in time (PIT). If you provide a PIT,
you cannot specify an <index> in the request path.
:param post_filter:
:param pre_filter_shard_size:
:param preference:
:param profile:
:param q:
:param query: Defines the search definition using the Query DSL.
:param request_cache:
:param rescore:
:param rest_total_hits_as_int:
:param routing:
:param runtime_mappings: Defines one or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
:param script_fields: Retrieve a script evaluation (based on different fields)
for each hit.
:param scroll:
:param search_after:
:param search_type:
:param seq_no_primary_term: If true, returns sequence number and primary term
of the last modification of each hit. See Optimistic concurrency control.
:param size: The number of hits to return. By default, you cannot page through
more than 10,000 hits using the from and size parameters. To page through
more hits, use the search_after parameter.
:param slice:
:param sort:
:param source: Indicates which source fields are returned for matching documents.
These fields are returned in the hits._source property of the search response.
:param source_excludes:
:param source_includes:
:param stats: Stats groups to associate with the search. Each group maintains
a statistics aggregation for its associated searches. You can retrieve these
stats using the indices stats API.
:param stored_fields: List of stored fields to return as part of a hit. If no
fields are specified, no stored fields are included in the response. If this
field is specified, the _source parameter defaults to false. You can pass
_source: true to return both source fields and stored fields in the search
response.
:param suggest:
:param suggest_field: Specifies which field to use for suggestions.
:param suggest_mode:
:param suggest_size:
:param suggest_text: The source text for which the suggestions should be returned.
:param terminate_after: Maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
Elasticsearch collects documents before sorting. Defaults to 0, which does
not terminate query execution early.
:param timeout: Specifies the period of time to wait for a response from each
shard. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to no timeout.
:param track_scores: If true, calculate and return document scores, even if the
scores are not used for sorting.
:param track_total_hits: Number of hits matching the query to count accurately.
If true, the exact number of hits is returned at the cost of some performance.
If false, the response does not include the total number of hits matching
the query. Defaults to 10,000 hits.
:param typed_keys:
:param version: If true, returns document version as part of a hit.
:param wait_for_checkpoints: A comma separated list of checkpoints. When configured,
the search API will only be executed on a shard after the relevant checkpoint
has become visible for search. Defaults to an empty list which will cause
Elasticsearch to immediately execute the search.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'index'")
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
__path = f'/{__path_parts["index"]}/_fleet/_fleet_search'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
# The 'sort' parameter with a colon can't be encoded to the body.
if sort is not None and (
(isinstance(sort, str) and ":" in sort)
or (
isinstance(sort, (list, tuple))
and all(isinstance(_x, str) for _x in sort)
and any(":" in _x for _x in sort)
)
):
__query["sort"] = sort
sort = None
if allow_no_indices is not None:
__query["allow_no_indices"] = allow_no_indices
if allow_partial_search_results is not None:
__query["allow_partial_search_results"] = allow_partial_search_results
if analyze_wildcard is not None:
__query["analyze_wildcard"] = analyze_wildcard
if analyzer is not None:
__query["analyzer"] = analyzer
if batched_reduce_size is not None:
__query["batched_reduce_size"] = batched_reduce_size
if ccs_minimize_roundtrips is not None:
__query["ccs_minimize_roundtrips"] = ccs_minimize_roundtrips
if default_operator is not None:
__query["default_operator"] = default_operator
if df is not None:
__query["df"] = df
if error_trace is not None:
__query["error_trace"] = error_trace
if expand_wildcards is not None:
__query["expand_wildcards"] = expand_wildcards
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if ignore_throttled is not None:
__query["ignore_throttled"] = ignore_throttled
if ignore_unavailable is not None:
__query["ignore_unavailable"] = ignore_unavailable
if lenient is not None:
__query["lenient"] = lenient
if max_concurrent_shard_requests is not None:
__query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
if pre_filter_shard_size is not None:
__query["pre_filter_shard_size"] = pre_filter_shard_size
if preference is not None:
__query["preference"] = preference
if pretty is not None:
__query["pretty"] = pretty
if q is not None:
__query["q"] = q
if request_cache is not None:
__query["request_cache"] = request_cache
if rest_total_hits_as_int is not None:
__query["rest_total_hits_as_int"] = rest_total_hits_as_int
if routing is not None:
__query["routing"] = routing
if scroll is not None:
__query["scroll"] = scroll
if search_type is not None:
__query["search_type"] = search_type
if source_excludes is not None:
__query["_source_excludes"] = source_excludes
if source_includes is not None:
__query["_source_includes"] = source_includes
if suggest_field is not None:
__query["suggest_field"] = suggest_field
if suggest_mode is not None:
__query["suggest_mode"] = suggest_mode
if suggest_size is not None:
__query["suggest_size"] = suggest_size
if suggest_text is not None:
__query["suggest_text"] = suggest_text
if typed_keys is not None:
__query["typed_keys"] = typed_keys
if wait_for_checkpoints is not None:
__query["wait_for_checkpoints"] = wait_for_checkpoints
if not __body:
if aggregations is not None:
__body["aggregations"] = aggregations
if aggs is not None:
__body["aggs"] = aggs
if collapse is not None:
__body["collapse"] = collapse
if docvalue_fields is not None:
__body["docvalue_fields"] = docvalue_fields
if explain is not None:
__body["explain"] = explain
if ext is not None:
__body["ext"] = ext
if fields is not None:
__body["fields"] = fields
if from_ is not None:
__body["from"] = from_
if highlight is not None:
__body["highlight"] = highlight
if indices_boost is not None:
__body["indices_boost"] = indices_boost
if min_score is not None:
__body["min_score"] = min_score
if pit is not None:
__body["pit"] = pit
if post_filter is not None:
__body["post_filter"] = post_filter
if profile is not None:
__body["profile"] = profile
if query is not None:
__body["query"] = query
if rescore is not None:
__body["rescore"] = rescore
if runtime_mappings is not None:
__body["runtime_mappings"] = runtime_mappings
if script_fields is not None:
__body["script_fields"] = script_fields
if search_after is not None:
__body["search_after"] = search_after
if seq_no_primary_term is not None:
__body["seq_no_primary_term"] = seq_no_primary_term
if size is not None:
__body["size"] = size
if slice is not None:
__body["slice"] = slice
if sort is not None:
__body["sort"] = sort
if source is not None:
__body["_source"] = source
if stats is not None:
__body["stats"] = stats
if stored_fields is not None:
__body["stored_fields"] = stored_fields
if suggest is not None:
__body["suggest"] = suggest
if terminate_after is not None:
__body["terminate_after"] = terminate_after
if timeout is not None:
__body["timeout"] = timeout
if track_scores is not None:
__body["track_scores"] = track_scores
if track_total_hits is not None:
__body["track_total_hits"] = track_total_hits
if version is not None:
__body["version"] = version
if not __body:
__body = None # type: ignore[assignment]
__headers = {"accept": "application/json"}
if __body is not None:
__headers["content-type"] = "application/json"
return self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="fleet.search",
path_parts=__path_parts,
)
|