-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathSearchResponse.ts
85 lines (82 loc) · 3.13 KB
/
SearchResponse.ts
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
/*
* 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 { Dictionary } from '@spec_utils/Dictionary'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { Aggregate } from '@_types/aggregations/Aggregate'
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'
import { double, long } from '@_types/Numeric'
import { ClusterStatistics, ShardStatistics } from '@_types/Stats'
import { HitsMetadata } from './_types/hits'
import { Profile } from './_types/profile'
import { Suggest } from './_types/suggester'
// Keep changes in sync with:
// - search
// - fleet.search
// - scroll
export class Response<TDocument> {
/** @codegen_name result */
body: ResponseBody<TDocument>
}
export class ResponseBody<TDocument> {
// Has to be kept in sync with SearchTemplateResponse
/**
* The number of milliseconds it took Elasticsearch to run the request.
* This value is calculated by measuring the time elapsed between receipt of a request on the coordinating node and the time at which the coordinating node is ready to send the response.
* It includes:
*
* * Communication time between the coordinating node and data nodes
* * Time the request spends in the search thread pool, queued for execution
* * Actual run time
*
* It does not include:
*
* * Time needed to send the request to Elasticsearch
* * Time needed to serialize the JSON response
* * Time needed to send the response to a client
*/
took: long
/**
* If `true`, the request timed out before completion; returned results may be partial or empty.
*/
timed_out: boolean
/**
* A count of shards used for the request.
*/
_shards: ShardStatistics
/**
* The returned documents and metadata.
*/
hits: HitsMetadata<TDocument>
aggregations?: Dictionary<AggregateName, Aggregate>
_clusters?: ClusterStatistics
fields?: Dictionary<string, UserDefinedValue>
max_score?: double
num_reduce_phases?: long
profile?: Profile
pit_id?: Id
/**
* The identifier for the search and its search context.
* You can use this scroll ID with the scroll API to retrieve the next batch of search results for the request.
* This property is returned only if the `scroll` query parameter is specified in the request.
* @ext_doc_id scroll-search-results
*/
_scroll_id?: ScrollId
suggest?: Dictionary<SuggestionName, Suggest<TDocument>[]>
terminated_early?: boolean
}