Skip to content

Commit 063d015

Browse files
committed
Introduce UserDefinedObject
1 parent ccc7533 commit 063d015

File tree

11 files changed

+65
-30
lines changed

11 files changed

+65
-30
lines changed

specification/_global/get/types.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
* under the License.
1818
*/
1919

20-
import { Id, IndexName, SequenceNumber, VersionNumber } from '@_types/common'
20+
import {
21+
Id,
22+
IndexName,
23+
SequenceNumber,
24+
UserDefinedObject,
25+
VersionNumber
26+
} from '@_types/common'
2127
import { long } from '@_types/Numeric'
22-
import { Dictionary } from '@spec_utils/Dictionary'
23-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2428

2529
export class GetResult<TDocument> {
2630
/**
@@ -30,7 +34,7 @@ export class GetResult<TDocument> {
3034
/**
3135
* If the `stored_fields` parameter is set to `true` and `found` is `true`, it contains the document fields stored in the index.
3236
*/
33-
fields?: Dictionary<string, UserDefinedValue>
37+
fields?: UserDefinedObject
3438
_ignored?: string[]
3539
/**
3640
* Indicates whether the document exists.

specification/_global/search/SearchResponse.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@
1818
*/
1919

2020
import { Aggregate } from '@_types/aggregations/Aggregate'
21-
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'
21+
import {
22+
AggregateName,
23+
Id,
24+
ScrollId,
25+
SuggestionName,
26+
UserDefinedObject
27+
} from '@_types/common'
2228
import { double, long } from '@_types/Numeric'
2329
import { ClusterStatistics, ShardStatistics } from '@_types/Stats'
2430
import { Dictionary } from '@spec_utils/Dictionary'
25-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2631
import { HitsMetadata } from './_types/hits'
2732
import { Profile } from './_types/profile'
2833
import { Suggest } from './_types/suggester'
@@ -68,7 +73,7 @@ export class ResponseBody<TDocument> {
6873
hits: HitsMetadata<TDocument>
6974
aggregations?: Dictionary<AggregateName, Aggregate>
7075
_clusters?: ClusterStatistics
71-
fields?: Dictionary<string, UserDefinedValue>
76+
fields?: UserDefinedObject
7277
max_score?: double
7378
num_reduce_phases?: long
7479
profile?: Profile

specification/_global/search/_types/hits.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
IndexName,
2525
Name,
2626
SequenceNumber,
27+
UserDefinedObject,
2728
VersionNumber
2829
} from '@_types/common'
2930
import { double, integer, long } from '@_types/Numeric'
@@ -49,7 +50,7 @@ export class Hit<TDocument> {
4950
// See https://github.com/elastic/elasticsearch-specification/pull/5248
5051
_score?: double | null
5152
_explanation?: Explanation
52-
fields?: Dictionary<string, UserDefinedValue>
53+
fields?: UserDefinedObject
5354
highlight?: Dictionary<string, string[]>
5455
inner_hits?: Dictionary<string, InnerHitsResult>
5556
matched_queries?: string[] | Dictionary<string, double>

specification/_global/search/_types/suggester.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import {
2323
Id,
2424
IndexName,
2525
Routing,
26-
SuggestMode
26+
SuggestMode,
27+
UserDefinedObject
2728
} from '@_types/common'
2829
import { GeoHashPrecision, GeoLocation } from '@_types/Geo'
2930
import { double, float, integer, long } from '@_types/Numeric'
@@ -74,7 +75,7 @@ export class TermSuggest extends SuggestBase {
7475
export class CompletionSuggestOption<TDocument> {
7576
collate_match?: boolean
7677
contexts?: Dictionary<string, Context[]>
77-
fields?: Dictionary<string, UserDefinedValue>
78+
fields?: UserDefinedObject
7879
_id?: string
7980
_index?: IndexName
8081
_routing?: Routing

specification/_global/search_template/SearchTemplateResponse.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@
1818
*/
1919

2020
import { Aggregate } from '@_types/aggregations/Aggregate'
21-
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'
21+
import {
22+
AggregateName,
23+
Id,
24+
ScrollId,
25+
SuggestionName,
26+
UserDefinedObject
27+
} from '@_types/common'
2228
import { double, long } from '@_types/Numeric'
2329
import { ClusterStatistics, ShardStatistics } from '@_types/Stats'
2430
import { HitsMetadata } from '@global/search/_types/hits'
2531
import { Profile } from '@global/search/_types/profile'
2632
import { Suggest } from '@global/search/_types/suggester'
2733
import { Dictionary } from '@spec_utils/Dictionary'
28-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2934

3035
export class Response<TDocument> {
3136
body: {
@@ -36,7 +41,7 @@ export class Response<TDocument> {
3641
hits: HitsMetadata<TDocument>
3742
aggregations?: Dictionary<AggregateName, Aggregate>
3843
_clusters?: ClusterStatistics
39-
fields?: Dictionary<string, UserDefinedValue>
44+
fields?: UserDefinedObject
4045
max_score?: double
4146
num_reduce_phases?: long
4247
profile?: Profile

specification/_types/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export type DataStreamNames = DataStreamName | DataStreamName[]
9292
/** @doc_id byte-units */
9393
export type ByteSize = long | string
9494

95+
export type UserDefinedObject = Dictionary<string, UserDefinedValue>
9596
export type Metadata = Dictionary<string, UserDefinedValue>
9697

9798
// Versioning Numbers & Strings
@@ -328,7 +329,7 @@ export enum WaitForEvents {
328329
export class InlineGet<TDocument>
329330
implements AdditionalProperties<string, UserDefinedValue>
330331
{
331-
fields?: Dictionary<string, UserDefinedValue>
332+
fields?: UserDefinedObject
332333
found: boolean
333334
_seq_no?: SequenceNumber
334335
_primary_term?: long

specification/async_search/_types/AsyncSearch.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,27 @@
1818
*/
1919

2020
import { Aggregate } from '@_types/aggregations/Aggregate'
21-
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'
21+
import {
22+
AggregateName,
23+
Id,
24+
ScrollId,
25+
SuggestionName,
26+
UserDefinedObject
27+
} from '@_types/common'
2228
import { double, long } from '@_types/Numeric'
2329
import { ClusterStatistics, ShardStatistics } from '@_types/Stats'
2430
import { HitsMetadata } from '@global/search/_types/hits'
2531
import { Profile } from '@global/search/_types/profile'
2632
import { Suggest } from '@global/search/_types/suggester'
2733
import { Dictionary } from '@spec_utils/Dictionary'
28-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2934

3035
export class AsyncSearch<TDocument> {
3136
/**
3237
* Partial aggregations results, coming from the shards that have already completed running the query.
3338
*/
3439
aggregations?: Dictionary<AggregateName, Aggregate>
3540
_clusters?: ClusterStatistics
36-
fields?: Dictionary<string, UserDefinedValue>
41+
fields?: UserDefinedObject
3742
hits: HitsMetadata<TDocument>
3843
max_score?: double
3944
/**

specification/fleet/search/SearchResponse.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@
1818
*/
1919

2020
import { Aggregate } from '@_types/aggregations/Aggregate'
21-
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'
21+
import {
22+
AggregateName,
23+
Id,
24+
ScrollId,
25+
SuggestionName,
26+
UserDefinedObject
27+
} from '@_types/common'
2228
import { double, long } from '@_types/Numeric'
2329
import { ClusterStatistics, ShardStatistics } from '@_types/Stats'
2430
import { HitsMetadata } from '@global/search/_types/hits'
2531
import { Profile } from '@global/search/_types/profile'
2632
import { Suggest } from '@global/search/_types/suggester'
2733
import { Dictionary } from '@spec_utils/Dictionary'
28-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2934

3035
// Keep changes in sync with:
3136
// - search
@@ -38,7 +43,7 @@ export class Response<TDocument> {
3843
hits: HitsMetadata<TDocument>
3944
aggregations?: Dictionary<AggregateName, Aggregate>
4045
_clusters?: ClusterStatistics
41-
fields?: Dictionary<string, UserDefinedValue>
46+
fields?: UserDefinedObject
4247
max_score?: double
4348
num_reduce_phases?: long
4449
profile?: Profile

specification/ingest/_types/Simulation.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
* under the License.
1818
*/
1919

20-
import { Id, IndexName, Name, VersionNumber, VersionType } from '@_types/common'
20+
import {
21+
Id,
22+
IndexName,
23+
Name,
24+
UserDefinedObject,
25+
VersionNumber,
26+
VersionType
27+
} from '@_types/common'
2128
import { ErrorCause } from '@_types/Errors'
2229
import { DateTime } from '@_types/Time'
2330
import { AdditionalProperties } from '@spec_utils/behaviors'
24-
import { Dictionary } from '@spec_utils/Dictionary'
2531
import { Stringified } from '@spec_utils/Stringified'
2632
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2733

@@ -106,7 +112,7 @@ export class DocumentSimulation
106112
/**
107113
* JSON body for the document.
108114
*/
109-
_source: Dictionary<string, UserDefinedValue>
115+
_source: UserDefinedObject
110116
/**
111117
*
112118
*/

specification/ml/infer_trained_model/MlInferTrainedModelRequest.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
*/
1919

2020
import { RequestBase } from '@_types/Base'
21-
import { Id } from '@_types/common'
21+
import { Id, UserDefinedObject } from '@_types/common'
2222
import { Duration } from '@_types/Time'
2323
import { InferenceConfigUpdateContainer } from '@ml/_types/inference'
24-
import { Dictionary } from '@spec_utils/Dictionary'
25-
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2624

2725
/**
2826
* Evaluate a trained model.
@@ -58,7 +56,7 @@ export interface Request extends RequestBase {
5856
* configured trained model input. Typically, for NLP models, the field name is `text_field`.
5957
* Currently, for NLP models, only a single value is allowed.
6058
*/
61-
docs: Dictionary<string, UserDefinedValue>[]
59+
docs: UserDefinedObject[]
6260
/**
6361
* The inference configuration updates to apply on the API call
6462
*/

0 commit comments

Comments
 (0)