forked from opensearch-project/opensearch-protobufs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.proto
More file actions
executable file
·3928 lines (2674 loc) · 146 KB
/
Copy pathcommon.proto
File metadata and controls
executable file
·3928 lines (2674 loc) · 146 KB
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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
This is generated from the spec. DO NOT manually modify.
*/
syntax = "proto3";
package org.opensearch.protobufs;
option go_package = "github.com/opensearch-project/opensearch-protobufs/go/opensearchpb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "org.opensearch.protobufs";
import "google/protobuf/descriptor.proto";
// Custom field option for tooling
extend google.protobuf.FieldOptions {
// Mark a field to be skipped by tooling. These fields are manually maintained and won't be marked as deprecated.
optional bool tooling_skip = 50001;
}
// The Search API operation to perform a search across all indices in the cluster or index search
message SearchRequest {
// [optional] A list of indices to search for documents. If not provided, the default value will be to search through all indexes.
repeated string index = 1;
// [optional] Whether to include the _source field in the response.
optional SourceConfigParam x_source = 2;
// [optional] A list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `source_includes` query parameter. If the `source` parameter is `false`, this parameter is ignored.
repeated string x_source_excludes = 3;
// [optional] A list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `source_excludes` query parameter. If the `source` parameter is `false`, this parameter is ignored.
repeated string x_source_includes = 4;
// [optional] Whether to ignore wildcards that don't match any indexes. Default is true.
optional bool allow_no_indices = 5;
// [optional] Whether to return partial results if the request runs into an error or times out. Default is true.
optional bool allow_partial_search_results = 6;
// [optional] Whether the update operation should include wildcard and prefix queries in the analysis. Default is false.
optional bool analyze_wildcard = 7;
// [optional] How many shard results to reduce on a node. Default is 512.
optional int32 batched_reduce_size = 8;
// [optional] The time after which the search request will be canceled. Request-level parameter takes precedence over cancel_after_time_interval cluster setting. Default is -1.
optional string cancel_after_time_interval = 9;
// [optional] Whether to minimize round-trips between a node and remote clusters. Default is true.
optional bool ccs_minimize_roundtrips = 10;
// [optional] Indicates whether the default operator for a string query should be AND or OR. Default is OR.
optional Operator default_operator = 11;
// [optional] The default field in case a field prefix is not provided in the query string.
optional string df = 12;
// [optional] The fields that OpenSearch should return using their docvalue forms.
repeated string docvalue_fields = 13;
// [optional] Specifies the type of index that wildcard expressions can match. Supports list of values. Default is open.
repeated ExpandWildcard expand_wildcards = 14;
// [optional] Whether to ignore concrete, expanded, or indexes with aliases if indexes are frozen. Default is true.
optional bool ignore_throttled = 15;
// [optional] Specifies whether to include missing or closed indexes in the response and ignores unavailable shards during the search request. Default is false.
optional bool ignore_unavailable = 16;
// [optional] Numbers of concurrent shard requests this request should execute on each node. Default is 5.
optional int32 max_concurrent_shard_requests = 17;
// [optional] Whether to return phase-level took time values in the response. Default is false.
optional bool phase_took = 18;
// [optional] A prefilter size threshold that triggers a prefilter operation if the request exceeds the threshold. Default is 128 shards.
optional int32 pre_filter_shard_size = 19;
// [optional] Specifies the shards or nodes on which OpenSearch should perform the search. For valid values see "https://opensearch.org/docs/latest/api-reference/search/#the-preference-query-parameter"
optional string preference = 20;
// [optional] Query in the Lucene query string syntax using query parameter search.
optional string q = 21;
// [optional] Specifies whether OpenSearch should use the request cache. Default is whether it's enabled in the index's settings.
optional bool request_cache = 22;
// [optional] Indicates whether to return hits.total as an integer. Returns an object otherwise. Default is false.
optional bool total_hits_as_int = 23;
// [optional] Value used to route the update by query operation to a specific shard.
repeated string routing = 24;
// [optional] Period to keep the search context open.
optional string scroll = 25;
// [optional] Whether OpenSearch should use global term and document frequencies when calculating relevance scores. Default is SEARCH_TYPE_QUERY_THEN_FETCH.
optional SearchType search_type = 26;
// [optional] Fields OpenSearch can use to look for similar terms.
optional string suggest_field = 27;
// [optional] The mode to use when searching. This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified.
optional SuggestMode suggest_mode = 28;
// [optional] Number of suggestions to return.
optional int32 suggest_size = 29;
// [optional] The source that suggestions should be based off of.
optional string suggest_text = 30;
// [optional] Whether returned aggregations and suggested terms should include their types in the response. Default is true.
optional bool typed_keys = 31;
// [optional] Search Request body
optional SearchRequestBody search_request_body = 32;
// [optional] Global parameters
// TODO not supported in server
optional GlobalParams global_params = 33;
}
message SearchRequestBody {
// [optional] The collapse parameter groups search results by a particular field value. This returns only the top document within each group, which helps reduce redundancy by eliminating duplicates.
optional FieldCollapse collapse = 2;
// [optional] Whether to return details about how OpenSearch computed the document's score. Default is false.
optional bool explain = 3;
// [optional] ext object is to contain plugin-specific response fields. For example, in conversational search, the result of Retrieval Augmented Generation (RAG) is a single “hit” (answer). Plugin authors can include this answer in the search response as part of the ext object so that it is separate from the search hits.
optional ObjectMap ext = 4;
// [optional] The starting index to search from. Default is 0.
optional int32 from = 5;
// [optional] Highlighting emphasizes the search term(s) in the results so you can emphasize the query matches.
optional Highlight highlight = 6;
// [optional] Whether to return how many documents matched the query.
optional TrackHits track_total_hits = 7;
// [optional] Values used to boost the score of specified indexes. Specify in the format of <index> : <boost-multiplier>
map<string, float> indices_boost = 8 [deprecated = true];
// [optional] The fields that OpenSearch should return using their docvalue forms. Specify a format to return results in a certain format, such as date and time.
repeated FieldAndFormat docvalue_fields = 9;
// [optional] Specify a score threshold to return only documents above the threshold.
optional float min_score = 11;
// [optional] Use post_filter to refine search hits based on user selections while preserving all aggregation options.
optional QueryContainer post_filter = 12;
// [optional] Profile provides timing information about the execution of individual components of a search request. Using the Profile API, you can debug slow requests and understand how to improve their performance.
optional bool profile = 13;
// [optional] Customizable sequence of processing stages applied to search queries.
optional string search_pipeline = 14;
// [optional] Enables or disables verbose mode for the search pipeline.
optional bool verbose_pipeline = 15;
// [optional] The DSL query to use in the request.
optional QueryContainer query = 16;
// [optional] Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.
repeated Rescore rescore = 17;
// [optional] The script_fields parameter allows you to include custom fields whose values are computed using scripts in your search results. This can be useful for calculating values dynamically based on the document data. You can also retrieve derived fields by using a similar approach.
map<string, ScriptField> script_fields = 18;
// [optional] The search_after parameter provides a live cursor that uses the previous page's results to obtain the next page's results. It is similar to the scroll operation in that it is meant to scroll many queries in parallel. You can use search_after only when sorting is applied.
repeated FieldValue search_after = 19;
// [optional] The number of results to return. Default is 10.
optional int32 size = 20;
// [optional] You can use the scroll operation to retrieve a large number of results. For example, for machine learning jobs, you can request an unlimited number of results in batches.
optional SlicedScroll slice = 21;
// [optional] Sorting allows your users to sort results in a way that's most meaningful to them. By default, full-text queries sort results by the relevance score. You can choose to sort the results by any field value in either ascending or descending order by setting the order parameter to asc or desc.
repeated SortCombinations sort = 22;
// [optional] Whether to include the _source field in the response.
optional SourceConfig x_source = 23;
// [optional] The fields to search for in the request. Specify a format to return results in a certain format, such as date and time.
repeated FieldAndFormat fields = 24;
// [optional] The maximum number of documents OpenSearch should process before terminating the request. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. If set to `0` (default), the query does not terminate early. Default is 0.
optional int32 terminate_after = 26;
// [optional] The period of time to wait for a response. Default is no timeout. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.
optional string timeout = 27;
// [optional] Whether to return document scores. Default is false.
optional bool track_scores = 28;
// [optional] Whether to return scores with named queries. Default is false.
optional bool include_named_queries_score = 29;
// [optional] Whether to include the document version in the response.
optional bool version = 30;
// [optional] Whether to return sequence number and primary term of the last operation of each document hit.
optional bool seq_no_primary_term = 31;
// [optional] A 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 option 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.
repeated string stored_fields = 32;
// [optional] Point in Time (PIT) lets you run different queries against a dataset that is fixed in time.
optional PointInTimeReference pit = 33;
// [optional] Value to associate with the request for additional logging.
repeated string stats = 34;
// [optional]
map<string, DerivedField> derived = 35;
// [optional] Values used to boost the score of specified indexes. Specify in the format of <index> : <boost-multiplier>
repeated FloatMap indices_boost_2 = 36;
// Defines the aggregations that are run as part of the search request.
map<string, AggregationContainer> aggregations = 37;
}
message DerivedField {
// [required]
string name = 1;
// [required]
string type = 2;
// [required]
Script script = 3;
// [optional]
optional string prefilter_field = 4;
// [optional]
optional ObjectMap properties = 5;
// [optional]
optional bool ignore_malformed = 6;
// [optional]
optional string format = 7;
}
message TrackHits {
oneof track_hits {
bool enabled = 1;
int32 count = 2;
}
}
// The response from search request.
message SearchResponse {
// [required] Milliseconds it took Elasticsearch to execute the request.
int64 took = 1;
// [required] If true, the request timed out before completion; returned results may be partial or empty.
bool timed_out = 2;
// [required] Contains a count of shards used for the request.
ShardStatistics x_shards = 3;
// [optional] Phase-level took time values in the response.
optional PhaseTook phase_took = 4;
// [required] Contains returned documents and metadata.
HitsMetadata hits = 5;
// [optional]
repeated ProcessorExecutionDetail processor_results = 6;
// [optional] When you search one or more remote clusters, a `_clusters` section is included to provide information about the search on each cluster.
optional ClusterStatistics x_clusters = 7;
// [optional] Retrieved specific fields in the search response
optional ObjectMap fields = 8 [deprecated = true];
// [optional] The number of times that the coordinating node aggregates results from batches of shard responses
optional int32 num_reduce_phases = 9;
// [optional] Contains profiling information.
optional Profile profile = 10;
// [optional] The PIT ID.
optional string pit_id = 11;
// [optional] Identifier for the search and its search context.
optional string x_scroll_id = 12;
// [optional] If the query was terminated early, the terminated_early flag will be set to true in the response
optional bool terminated_early = 13;
map<string, Aggregate> aggregations = 14;
}
message ProcessorExecutionDetail {
// [optional]
optional string processor_name = 1;
// [optional]
optional int64 duration_millis = 2;
// [optional]
optional ObjectMap input_data = 3;
// [optional]
optional ObjectMap output_data = 4;
// [optional]
optional string status = 5;
// [optional]
optional string tag = 6;
// [optional]
optional string error = 7;
}
message PhaseTook {
// [required] Time taken in dfs_pre_query phase.
int64 dfs_pre_query = 1;
// [required] Time taken in query phase.
int64 query = 2;
// [required] Time taken in fetch phase.
int64 fetch = 3;
// [required] Time taken in dfs_query phase.
int64 dfs_query = 4;
// [required] Time taken in expand phase.
int64 expand = 5;
// [required] Time taken in can_match phase.
int64 can_match = 6;
}
message HitsMetadataTotal {
oneof hits_metadata_total {
TotalHits total_hits = 1;
int64 int64 = 2;
}
}
message HitsMetadataMaxScore {
oneof hits_metadata_max_score {
float float = 1;
NullValue null_value = 2;
}
}
message HitsMetadata {
// [optional] Metadata about the number of matching documents.
optional HitsMetadataTotal total = 1;
// [required] Array of returned document objects.
repeated HitsMetadataHitsInner hits = 2;
HitsMetadataMaxScore max_score = 3;
}
message TotalHits {
// [required] Indicates whether the number of matching documents in the value parameter is accurate or a lower bound.
TotalHitsRelation relation = 1;
// [required] Total number of matching documents.
int64 value = 2;
}
message InnerHitsResult {
// [required] An additional nested hits value.
HitsMetadata hits = 1;
}
message HitXScore {
oneof hit_x_score {
NullValue null_value = 1;
double double = 2;
}
}
message HitsMetadataHitsInner {
optional string x_type = 1;
// [optional] Name of the index containing the returned document.
optional string x_index = 2;
// [optional] Unique identifier for the returned document. This ID is only unique within the returned index.
optional string x_id = 3;
// [optional] Relevance of the returned document.
optional HitXScore x_score = 4;
// [optional] Explanation of how the relevance score (_score) is calculated for every result.
optional Explanation x_explanation = 5;
// [optional] Contains field values for the documents.
optional ObjectMap fields = 6;
// [optional] An additional highlight element for each search hit that includes the highlighted fields and the highlighted fragments.
map<string, StringArray> highlight = 7;
// [optional] An additional nested hits that caused a search hit to match in a different scope.
map<string, InnerHitsResult> inner_hits = 8;
// [optional] List of matched query names used in the search request.
repeated string matched_queries = 9 [deprecated = true];
// [optional] Defines from what inner nested object this inner hit came from
optional NestedIdentity x_nested = 10;
// [optional] List of fields ignored.
repeated string x_ignored = 11;
// [optional] These values are retrieved from the document’s original JSON source and are raw so will not be formatted or treated in any way, unlike the successfully indexed fields which are returned in the fields section.
map<string, StringArray> ignored_field_values = 12;
// [optional] Shard from which this document was retrieved.
optional string x_shard = 13;
// [optional] Node from which this document was retrieved.
optional string x_node = 14;
optional string x_routing = 15;
// [optional] Source document.
optional bytes x_source = 16;
// [optional] Counts the number of operations that happened on the index
optional int64 x_seq_no = 17;
// [optional] Counts the number of shard has changed.
optional int64 x_primary_term = 18;
// [optional] Version number of the document.
optional int64 x_version = 19;
// [optional] Sorted values
repeated FieldValue sort = 20;
// [optional] Contains metadata values for the documents.
optional ObjectMap meta_fields = 21;
// [optional] List of matched query names used in the search request.
optional HitMatchedQueries matched_queries_2 = 22;
}
message ClusterStatistics {
// [required] Number of shards that skipped the request because a lightweight check helped realize that no documents could possibly match on this shard. This typically happens when a search request includes a range filter and the shard only has values that fall outside of that range.
int32 skipped = 1;
// [required] Number of shards that executed the request successfully.
int32 successful = 2;
// [required] Total number of shards that require querying, including unallocated shards.
int32 total = 3;
}
message Profile {
// [required] A search request can be executed against one or more shards in the index, and a search may involve one or more indexes. Thus, the profile.shards array contains profiling information for each shard that was involved in the search.
repeated ShardProfile shards = 1;
}
message RescoreQuery {
// [required] A second query only on the Top-K results returned by the query and post_filter phases.
QueryContainer rescore_query = 1;
// [optional] The relative importance of the original query as compared to the rescore query.
optional float query_weight = 2;
// [optional] The relative importance of the rescore query as compared to the original query.
optional float rescore_query_weight = 3;
// [optional] Control the way the scores are combined.
optional ScoreMode score_mode = 4;
}
message Rescore {
// [required] Contains the rescore_query, which is the secondary query used to adjust the scores of the initial results
RescoreQuery query = 1;
// [optional] The number of docs which will be examined on each shard can be controlled.
optional int32 window_size = 2;
}
message SlicedScroll {
// [optional] Specific document field by which slicing is performed.
optional string field = 1;
// [required] The id of the slice
int32 id = 2;
// [required] The maximum number of slices
int32 max = 3;
}
message ShardProfile {
// [required] Profiling information about the aggregation execution.
repeated AggregationProfile aggregations = 1;
// [required] The shard ID of the shard in the [node-ID][index-name][shard-ID] format.
string id = 2;
// [required] Search represents a query executed against the underlying Lucene index. Most search requests execute a single search against a Lucene index, but some search requests can execute more than one search. For example, including a global aggregation results in a secondary match_all query for the global context. The profile.shards array contains profiling information about each search execution.
repeated SearchProfile searches = 3;
// [optional] Fetch timing and debug information.
optional FetchProfile fetch = 4;
}
message AggregationProfile {
// [required]
AggregationBreakdown breakdown = 1;
// [required]
string description = 2;
// [required] Time unit for nanoseconds
int64 time_in_nanos = 3;
// [required]
string type = 4;
// [optional]
optional AggregationProfileDebug debug = 5;
// [optional]
repeated AggregationProfile children = 6;
}
message AggregationBreakdown {
// [required] Contains the time spent running the aggregation’s buildAggregations() method, which builds the results of this aggregation. For concurrent segment search, the build_aggregation method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 build_aggregation = 1;
// [required] Contains the number of invocations of a build_aggregation.
int64 build_aggregation_count = 2;
// [required] Contains the time spent running the aggregation’s getLeafCollector() method, which creates a new collector to collect the given context. For concurrent segment search, the build_leaf_collector method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 build_leaf_collector = 3;
// [required] Contains the number of invocations of a build_leaf_collector.
int64 build_leaf_collector_count = 4;
// [required] Contains the time spent collecting the documents into buckets. For concurrent segment search, the collect method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 collect = 5;
// [required] Contains the number of invocations of a collect.
int64 collect_count = 6;
// [required] Contains the amount of time taken to execute the preCollection() callback method during AggregationCollectorManager creation. For concurrent segment search, the initialize method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 initialize = 7;
// [required] Contains the number of invocations of a initialize.
int64 initialize_count = 8;
// [optional] Contains the time spent running the aggregation’s postCollection() callback method. For concurrent segment search, the post_collection method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
optional int64 post_collection = 9;
// [optional] Contains the number of invocations of a post_collection.
optional int64 post_collection_count = 10;
// [required] Contains the time spent in the reduce phase. For concurrent segment search, the reduce method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 reduce = 11;
// [required] Contains the number of invocations of a reduce.
int64 reduce_count = 12;
}
message SearchProfile {
// [required] Profiling information about the Lucene collectors that ran the search.
repeated Collector collector = 1;
// [required] Profiling information about the query execution.
repeated QueryProfile query = 2;
// [required] All Lucene queries are rewritten. A query and its children may be rewritten more than once, until the query stops changing. The rewriting process involves performing optimizations, such as removing redundant clauses or replacing a query path with a more efficient one. After the rewriting process, the original query may change significantly. The rewrite_time field contains the cumulative total rewrite time for the query and all its children, in nanoseconds.
int64 rewrite_time = 3;
}
message PointInTimeReference {
// [required] ID for the PIT to search. If you provide a pit object, this parameter is required.
string id = 1;
// [optional] Period of time used to extend the life of the PIT. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts \"0\" without a unit and \"-1\" to indicate an unspecified value.
optional string keep_alive = 2;
}
message Collector {
// [required] The collector name.
string name = 1;
// [required] Contains a description of the collector.
string reason = 2;
// [required] The total elapsed time for this collector, in nanoseconds. For concurrent segment search, time_in_nanos is the total amount of time across all slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 time_in_nanos = 3;
// [optional] If a collector has subcollectors (children), this field contains information about the subcollectors.
repeated Collector children = 4;
}
message QueryProfile {
// [required] Contains timing statistics about low-level Lucene execution.
QueryBreakdown breakdown = 1;
// [required] Contains a Lucene explanation of the query. Helps differentiate queries with the same type.
string description = 2;
// [required] The total elapsed time for this query, in nanoseconds. For concurrent segment search, time_in_nanos is the total time spent across all the slices (the difference between the last completed slice execution end time and the first slice execution start time).
int64 time_in_nanos = 3;
// [required] The Lucene query type into which the search query was rewritten. Corresponds to the Lucene class name (which often has the same name in OpenSearch).
string type = 4;
// [optional] If a query has subqueries (children), this field contains information about the subqueries.
repeated QueryProfile children = 5;
}
message QueryBreakdown {
// [required] The advance method is a lower-level version of the next_doc method in Lucene. It also finds the next matching document but necessitates that the calling query perform additional tasks, such as identifying skips. Some queries, such as conjunctions (must clauses in Boolean queries), cannot use next_doc. For those queries, advance is timed.
int64 advance = 1;
// [required] Contains the number of invocations of the advance method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 advance_count = 2;
// [required] A Scorer iterates over matching documents and generates a score for each document. The build_scorer field contains the amount of time spent generating the Scorer object. This does not include the time spent scoring the documents. The Scorer initialization time depends on the optimization and complexity of a particular query. The build_scorer parameter also includes the amount of time associated with caching, if caching is applicable and enabled for the query.
int64 build_scorer = 3;
// [required] Build_scorer_count contains the number of invocations of the build_scorer method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 build_scorer_count = 4;
// [required] A Query object in Lucene is immutable. Yet, Lucene should be able to reuse Query objects in multiple IndexSearcher objects. Thus, Query objects need to keep temporary state and statistics associated with the index in which the query is executed. To achieve reuse, every Query object generates a Weight object, which keeps the temporary context (state) associated with the <IndexSearcher, Query> tuple. The create_weight field contains the amount of time spent creating the Weight object.
int64 create_weight = 5;
// [required] Create_weight_count contains the number of invocations of the create_weight method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 create_weight_count = 6;
// [required] For some queries, document matching is performed in two steps. First, the document is matched approximately. Second, those documents that are approximately matched are examined through a more comprehensive process. For example, a phrase query first checks whether a document contains all terms in the phrase. Next, it verifies that the terms are in order (which is a more expensive process). The match field is non-zero only for those queries that use the two-step verification process.
int64 match = 7;
// [required] Match_count contains the number of invocations of the match method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 match_count = 8;
// [required] Contains the amount of time required to execute the advanceShallow Lucene method.
int64 shallow_advance = 9;
// [required] Shallow_advance_count contains the number of invocations of the shallow_advance method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 shallow_advance_count = 10;
// [required] The next_doc Lucene method returns the document ID of the next document that matches the query. This method is a special type of the advance method and is equivalent to advance(docId() + 1). The next_doc method is more convenient for many Lucene queries. The next_doc field contains the amount of time required to determine the next matching document, which varies depending on the query type.
int64 next_doc = 11;
// [required] Next_doc_count contains the number of invocations of the next_doc method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 next_doc_count = 12;
// [required] Contains the time taken for a Scorer to score a particular document.
int64 score = 13;
// [required] Score_count contains the number of invocations of the score method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 score_count = 14;
// [required] Contains the amount of time required to execute the getMaxScore Lucene method.
int64 compute_max_score = 15;
// [required] Compute_max_score_count contains the number of invocations of the compute_max_score method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 compute_max_score_count = 16;
// [required] Contains the amount of time required to execute the setMinCompetitiveScore Lucene method.
int64 set_min_competitive_score = 17;
// [required] Set_min_competitive_score_count contains the number of invocations of the set_min_competitive_score method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components.
int64 set_min_competitive_score_count = 18;
}
message FetchProfileDebug {
repeated string stored_fields = 1;
optional int32 fast_path = 2;
}
message FetchProfile {
string type = 1;
string description = 2;
// Time unit for nanoseconds
int64 time_in_nanos = 3;
FetchProfileBreakdown breakdown = 4;
optional FetchProfileDebug debug = 5;
repeated FetchProfile children = 6;
}
message FetchProfileBreakdown {
optional int32 load_source = 1;
optional int32 load_source_count = 2;
optional int32 load_stored_fields = 3;
optional int32 load_stored_fields_count = 4;
optional int32 next_reader = 5;
optional int32 next_reader_count = 6;
optional int32 process_count = 7;
optional int32 process = 8;
}
message AggregationProfileDebug {
optional int32 segments_with_multi_valued_ords = 1;
optional string collection_strategy = 2;
optional int32 segments_with_single_valued_ords = 3;
optional int32 total_buckets = 4;
optional int32 built_buckets = 5;
optional string result_strategy = 6;
optional bool has_filter = 7;
optional string delegate = 8;
optional AggregationProfileDelegateDebug delegate_debug = 9;
optional int32 chars_fetched = 10;
optional int32 extract_count = 11;
optional int32 extract_ns = 12;
optional int32 values_fetched = 13;
optional int32 collect_analyzed_ns = 14;
optional int32 collect_analyzed_count = 15;
optional int32 surviving_buckets = 16;
optional int32 ordinals_collectors_used = 17;
optional int32 ordinals_collectors_overhead_too_high = 18;
optional int32 string_hashing_collectors_used = 19;
optional int32 numeric_collectors_used = 20;
optional int32 empty_collectors_used = 21;
repeated string deferred_aggregators = 22;
optional string map_reducer = 28;
}
message AggregationProfileDelegateDebug {
optional int32 segments_with_doc_count_field = 1;
optional int32 segments_with_deleted_docs = 2;
repeated AggregationProfileDelegateDebugFilter filters = 3;
optional int32 segments_counted = 4;
optional int32 segments_collected = 5;
}
message AggregationProfileDelegateDebugFilter {
optional int32 results_from_metadata = 1;
optional string query = 2;
optional string specialized_for = 3;
optional int32 segments_counted_in_constant_time = 4;
}
message Explanation {
// [required] Explains what type of calculation is performed
string description = 1;
// [optional] Shows any subcalculations performed.
repeated Explanation details = 2;
// [required] Shows the result of the calculation,
float value = 3;
}
message NestedIdentity {
// [required] The name of the nested field.
string field = 1;
// [required] Indicates the position or index of the nested document.
int32 offset = 2;
// [optional] Inner nested object.
optional NestedIdentity x_nested = 3;
}
// The bulk operation lets you add, update, or delete multiple documents in a single request, index name needs to be specified in `BulkRequestBody`
message BulkRequest {
// [optional] If not provided here, index will be required in the BulkRequestBody instead
optional string index = 1;
// [optional] Set `true` or `false` to return the `_source` field or not, or a list of fields to return.
optional SourceConfigParam x_source = 2;
// [optional] A list of source fields to exclude from the response.
repeated string x_source_excludes = 3;
// [optional] A list of source fields to include in the response.
repeated string x_source_includes = 4;
// [optional] ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.
optional string pipeline = 5;
// [optional] The enum of whether to refresh the affected shards after performing the indexing operations. Default is false
optional Refresh refresh = 6;
// [optional] If `true`, the request's actions must target an index alias. Defaults to false.
optional bool require_alias = 7;
// [optional] Custom value used to route operations to a specific shard.
optional string routing = 8;
// [optional] Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. pattern: ^([0-9\.]+)(?:d|h|m|s|ms|micros|nanos)$. Defaults to 1m (one minute). This guarantees OpenSearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.
optional string timeout = 9;
// [deprecated] The default document type for documents that don't specify a type. Default is _doc. We highly recommend ignoring this parameter and using a type of _doc for all indexes.
optional string type = 10;
// [optional] The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed.
optional WaitForActiveShards wait_for_active_shards = 11;
// [required] The request body contains create, delete, index, and update actions and their associated source data
repeated BulkRequestBody bulk_request_body = 12;
// [optional] Global parameters
// TODO not supported in server
optional GlobalParams global_params = 13;
}
message BulkRequestBody {
// [required]
OperationContainer operation_container = 1;
// [optional]
optional UpdateAction update_action = 2;
// [optional]
optional bytes object = 3;
// EXPERIMENTAL field
// [optional] Map of fully-qualified field path -> typed value.
// This field is intended for large field values, such as large vectors, that
// should be provided separately from `_source`.
// Supported operations: index, create and update
// Compatibility:
// - May be provided together with `object`and update_action.
// - `object` and `update_action` continue to represent `_source`.
// - `extra_field_values` provides additional out-of-band field values and does
// not replace `_source`.
map<string, BinaryFieldValue> extra_field_values = 4 [(tooling_skip) = true];
}
message OperationContainer {
// [required] operation to perform (index, create, update, or delete)
oneof operation_container {
// Indexes the specified document. If the document exists, replaces the document and increments the version. It must followed with source data to be indexed in `doc` field.
IndexOperation index = 1;
// Indexes the specified document if it does not already exist. It must followed with the source data to be indexed in `object` field.
WriteOperation create = 2;
// Performs a partial document update. It must followed with the partial document and update options in in `doc` field.
UpdateOperation update = 3;
// Removes the specified document from the index.
DeleteOperation delete = 4;
}
}
message UpdateAction {
// [optional] When `false` disables the setting `result` in the response to `noop` if no change to the document occurred.
optional bool detect_noop = 1;
// [optional] A partial update to an existing document.
optional bytes doc = 2;
// [optional] When `true`, uses the contents of `doc` as the value of `upsert`.
optional bool doc_as_upsert = 3;
// [optional]
optional Script script = 4;
// [optional] When `true`, executes the script whether or not the document exists.
optional bool scripted_upsert = 5;
// [optional] If the document does not already exist, the contents of `upsert` are inserted as a new document. If the document exists, the `script` is executed.
optional bytes upsert = 6;
// [optional]
optional SourceConfig x_source = 7;
}
message IndexOperation {
// [optional] The document ID. If no ID is specified, a document ID is automatically generated.
optional string x_id = 1;
// [optional] Name of the the data stream, index, or index alias to perform the action on. This parameter is required if index not specified in bulk request.
optional string x_index = 2;
// [optional] Custom value used to route operations to a specific shard.
optional string routing = 3;
// [optional] Only perform the operation if the document has this primary term.
optional int64 if_primary_term = 4;
// [optional] Only perform the operation if the document has this sequence number
optional int64 if_seq_no = 5;
// [optional] Set to create to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. Same as using the `<index>/_create` endpoint. Valid values: `index`, `create`. If document id is specified, it defaults to `index`. Otherwise, it defaults to `create`.
optional OpType op_type = 6;
// [optional] Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.
optional int64 version = 7;
// [optional] Assigns a specific type to the document.
optional VersionType version_type = 8;
// [optional] ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.
optional string pipeline = 9;
// [optional] If `true`, the request's actions must target an index alias. Defaults to false.
optional bool require_alias = 10;
}
message WriteOperation {
// [optional] The routing value for the document.
optional string routing = 1;
// [optional] The unique identifier for a resource.
optional string x_id = 2;