Skip to content

Commit abd0575

Browse files
authored
Remove json_name annotations and prefix fields with underscore_ (opensearch-project#149)
* Remove json_name annotations and prefix fields with `underscore_` Signed-off-by: Karen Xu <karenxyr@gmail.com> * Update CHANGELOG.md Signed-off-by: Karen X <karenxyr@gmail.com> --------- Signed-off-by: Karen Xu <karenxyr@gmail.com> Signed-off-by: Karen X <karenxyr@gmail.com>
1 parent 1c5d44a commit abd0575

3 files changed

Lines changed: 77 additions & 74 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
77
- Add Go protobuf generation support ([#131](https://github.com/opensearch-project/opensearch-protobufs/pull/131))
88
- Add protobuf zip generation for releases ([#139](https://github.com/opensearch-project/opensearch-protobufs/pull/139))
99

10+
### Changed
11+
- Remove json_name annotations and prefix fields with `underscore_` ([#149](https://github.com/opensearch-project/opensearch-protobufs/pull/149))
12+
1013
### Removed
1114

1215
### Fixed

protos/schemas/common.proto

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ message NestedQuery {
432432
optional float boost = 1;
433433

434434
// [optional] Query name for query tagging.
435-
optional string underscore_name = 2 [json_name = "_name"];
435+
optional string underscore_name = 2;
436436

437437
// Set to `true` to ignore an unmapped field and not match any documents for this query. Set to `false` to throw an exception if the field is not mapped.
438438
bool ignore_unmapped = 3;
@@ -495,7 +495,7 @@ message InnerHits {
495495
repeated SortCombinations sort = 12;
496496

497497
// [optional] Select what fields of the source are returned
498-
optional SourceConfig source = 13 [json_name = "_source"];
498+
optional SourceConfig underscore_source = 13;
499499

500500
// [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.
501501
repeated string stored_fields = 14;
@@ -761,13 +761,13 @@ message FieldWithOrderMap {
761761
message SortOptions {
762762
oneof sort_options{
763763
// [optional] Sort by score.
764-
ScoreSort score = 1 [json_name = "_score"];
764+
ScoreSort underscore_score = 1;
765765
// [optional] Sort by index order.
766-
ScoreSort doc = 2 [json_name = "_doc"];
766+
ScoreSort underscore_doc = 2;
767767
// [optional] Sort by _geo_distance
768-
GeoDistanceSort geo_distance = 3 [json_name = "_geo_distance"];
768+
GeoDistanceSort underscore_geo_distance = 3;
769769
// [optional] Sort based on custom scripts
770-
ScriptSort script = 4 [json_name = "_script"];
770+
ScriptSort underscore_script = 4;
771771
}
772772
}
773773

@@ -925,7 +925,7 @@ message ScriptScoreQuery {
925925
optional float boost = 1;
926926

927927
// [optional] Query name for query tagging.
928-
optional string underscore_name = 2 [json_name = "_name"];
928+
optional string underscore_name = 2;
929929

930930
// Documents with a score lower than this floating point number are excluded from the search results.
931931
float min_score = 3;
@@ -944,7 +944,7 @@ message ExistsQuery {
944944
optional float boost = 2;
945945

946946
// [optional] Query name for query tagging.
947-
optional string underscore_name = 3 [json_name = "_name"];
947+
optional string underscore_name = 3;
948948
}
949949

950950
enum Operator {
@@ -959,7 +959,7 @@ message SimpleQueryStringQuery {
959959
optional float boost = 1;
960960

961961
// [optional] Query name for query tagging.
962-
optional string underscore_name = 2 [json_name = "_name"];
962+
optional string underscore_name = 2;
963963

964964
// Analyzer used to convert text in the query string into tokens.
965965
string analyzer = 3;
@@ -1005,7 +1005,7 @@ message WildcardQuery {
10051005
optional float boost = 2;
10061006

10071007
// [optional] The name of the query for query tagging.
1008-
optional string underscore_name = 3 [json_name = "_name"];
1008+
optional string underscore_name = 3;
10091009

10101010
// [optional] Allows case insensitive matching of the pattern with the indexed field values when set to `true`. Default is `false` which means the case sensitivity of matching depends on the underlying field's mapping.
10111011
optional bool case_insensitive = 4;
@@ -1083,7 +1083,7 @@ message KnnQuery {
10831083
optional float boost = 7;
10841084

10851085
// [optional] Query name for query tagging.
1086-
optional string underscore_name = 8 [json_name = "_name"];
1086+
optional string underscore_name = 8;
10871087

10881088
// [optional]
10891089
// Method parameters are dependent on the combination of engine and method used to create the index.
@@ -1128,7 +1128,7 @@ message MatchQuery {
11281128
optional float boost = 1;
11291129

11301130
// [optional] Query name for query tagging.
1131-
optional string underscore_name = 2 [json_name = "_name"];
1131+
optional string underscore_name = 2;
11321132

11331133
// [optional]
11341134
// The analyzer used to tokenize the query string text.
@@ -1244,7 +1244,7 @@ message BoolQuery {
12441244
optional float boost = 1;
12451245

12461246
// [optional] The name of the query for query tagging.
1247-
optional string underscore_name = 2 [json_name = "_name"];
1247+
optional string underscore_name = 2;
12481248

12491249
// [optional] The clause (query) must appear in matching documents. However, unlike `must`, the score of the query will be ignored.
12501250
repeated QueryContainer filter = 3;
@@ -1280,7 +1280,7 @@ message BoostingQuery {
12801280
optional float boost = 1;
12811281

12821282
// [optional] Query name for query tagging.
1283-
optional string underscore_name = 2 [json_name = "_name"];
1283+
optional string underscore_name = 2;
12841284

12851285
// Floating point number between 0 and 1.0 used to decrease the relevance scores of documents matching the `negative` query.
12861286
float negative_boost = 3;
@@ -1297,7 +1297,7 @@ message ConstantScoreQuery {
12971297
optional float boost = 1;
12981298

12991299
// [optional] Query name for query tagging.
1300-
optional string underscore_name = 2 [json_name = "_name"];
1300+
optional string underscore_name = 2;
13011301

13021302
QueryContainer filter = 3;
13031303

@@ -1309,7 +1309,7 @@ message DisMaxQuery {
13091309
optional float boost = 1;
13101310

13111311
// [optional] Query name for query tagging.
1312-
optional string underscore_name = 2 [json_name = "_name"];
1312+
optional string underscore_name = 2;
13131313

13141314
// One or more query clauses. Returned documents must match one or more of these queries. If a document matches multiple queries, OpenSearch uses the highest relevance score.
13151315
repeated QueryContainer queries = 3;
@@ -1325,7 +1325,7 @@ message FunctionScoreQuery {
13251325
optional float boost = 1;
13261326

13271327
// [optional] Query name for query tagging.
1328-
optional string underscore_name = 2 [json_name = "_name"];
1328+
optional string underscore_name = 2;
13291329

13301330
FunctionBoostMode boost_mode = 3;
13311331

@@ -1417,7 +1417,7 @@ message IntervalsQuery {
14171417
optional float boost = 2;
14181418

14191419
// [optional] Query name for query tagging.
1420-
optional string underscore_name = 3 [json_name = "_name"];
1420+
optional string underscore_name = 3;
14211421

14221422
oneof intervals_query {
14231423
IntervalsAllOf all_of = 4;
@@ -1514,7 +1514,7 @@ message PrefixQuery {
15141514
optional float boost = 2;
15151515

15161516
// [optional] Query name for query tagging.
1517-
optional string underscore_name = 3 [json_name = "_name"];
1517+
optional string underscore_name = 3;
15181518

15191519
// [optional]
15201520
// Determines how OpenSearch rewrites the query.
@@ -1571,7 +1571,7 @@ message TermsQueryField {
15711571
optional float boost = 1;
15721572

15731573
// [optional] Query name for query tagging.
1574-
optional string underscore_name = 2 [json_name = "_name"];
1574+
optional string underscore_name = 2;
15751575

15761576
// [optional] Specifies the types of values used for filtering. Valid values are default and bitmap. If omitted, the value defaults to default.
15771577
optional ValueType value_type = 3;
@@ -1611,7 +1611,7 @@ message TermsSetQuery {
16111611
optional float boost = 2;
16121612

16131613
// [optional] Query name for query tagging.
1614-
optional string underscore_name = 3 [json_name = "_name"];
1614+
optional string underscore_name = 3;
16151615

16161616
// [optional]
16171617
// The name of the numeric field that specifies the number of matching terms required in order to return a document in the results.
@@ -1635,7 +1635,7 @@ message TermQuery {
16351635
optional float boost = 2;
16361636

16371637
// [optional] Query name for query tagging.
1638-
optional string underscore_name = 3 [json_name = "_name"];
1638+
optional string underscore_name = 3;
16391639

16401640
// [required]
16411641
// Term you wish to find in the provided <field>. To return a document, the term must exactly match the field value, including whitespace and capitalization.
@@ -1653,7 +1653,7 @@ message QueryStringQuery {
16531653
optional float boost = 1;
16541654

16551655
// [optional] Query name for query tagging.
1656-
optional string underscore_name = 2 [json_name = "_name"];
1656+
optional string underscore_name = 2;
16571657

16581658
bool allow_leading_wildcard = 3;
16591659

@@ -1776,7 +1776,7 @@ message RegexpQuery {
17761776
optional float boost = 3;
17771777

17781778
// [optional] Query name for query tagging
1779-
optional string underscore_name = 4 [json_name = "_name"];
1779+
optional string underscore_name = 4;
17801780

17811781
// [optional] If true, allows case-insensitive matching of the regular expression value with the indexed field values. Default is false (case sensitivity is determined by the field’s mapping).
17821782
optional bool case_insensitive = 5;
@@ -1806,7 +1806,7 @@ message DateRangeQuery {
18061806
optional float boost = 1;
18071807

18081808
// [optional] Query name for query tagging.
1809-
optional string underscore_name = 2 [json_name = "_name"];
1809+
optional string underscore_name = 2;
18101810

18111811
RangeRelation relation = 3;
18121812
enum RangeRelation {
@@ -1853,7 +1853,7 @@ message NumberRangeQuery {
18531853
optional float boost = 1;
18541854

18551855
// [optional] Query name for query tagging.
1856-
optional string underscore_name = 2 [json_name = "_name"];
1856+
optional string underscore_name = 2;
18571857

18581858
RangeRelation relation = 3;
18591859
enum RangeRelation {
@@ -1903,7 +1903,7 @@ message FuzzyQuery {
19031903
optional float boost = 2;
19041904

19051905
// [optional] Query name for query tagging.
1906-
optional string underscore_name = 3 [json_name = "_name"];
1906+
optional string underscore_name = 3;
19071907

19081908
// [optional]
19091909
// The maximum number of terms to which the query can expand. Fuzzy queries "expand to" a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms. Default is 50.
@@ -1983,7 +1983,7 @@ message IdsQuery {
19831983
optional float boost = 1;
19841984

19851985
// [optional] Query name for query tagging.
1986-
optional string underscore_name = 2 [json_name = "_name"];
1986+
optional string underscore_name = 2;
19871987

19881988
repeated string values = 3;
19891989

@@ -2041,7 +2041,7 @@ message MatchAllQuery {
20412041
optional float boost = 1;
20422042

20432043
// [optional] Query name for query tagging.
2044-
optional string underscore_name = 2 [json_name = "_name"];
2044+
optional string underscore_name = 2;
20452045
}
20462046

20472047
message MatchBoolPrefixQuery {
@@ -2052,7 +2052,7 @@ message MatchBoolPrefixQuery {
20522052
optional float boost = 2;
20532053

20542054
// [optional] Query name for query tagging.
2055-
optional string underscore_name = 3 [json_name = "_name"];
2055+
optional string underscore_name = 3;
20562056

20572057
// [optional]
20582058
// The analyzer used to tokenize the query string text.
@@ -2128,7 +2128,7 @@ message MatchNoneQuery {
21282128
optional float boost = 1;
21292129

21302130
// [optional] Query name for query tagging.
2131-
optional string underscore_name = 2 [json_name = "_name"];
2131+
optional string underscore_name = 2;
21322132
}
21332133

21342134

@@ -2145,7 +2145,7 @@ message MatchPhrasePrefixQuery {
21452145
optional float boost = 1;
21462146

21472147
// [optional] Query name for query tagging.
2148-
optional string underscore_name = 2 [json_name = "_name"];
2148+
optional string underscore_name = 2;
21492149

21502150
// [optional]
21512151
// The analyzer used to tokenize the query string text.
@@ -2181,7 +2181,7 @@ message MatchPhraseQuery {
21812181
optional float boost = 2;
21822182

21832183
// [optional] The name of the query for query tagging.
2184-
optional string underscore_name = 3 [json_name = "_name"];
2184+
optional string underscore_name = 3;
21852185

21862186
// [optional]
21872187
// The analyzer used to tokenize the query string text.
@@ -2211,7 +2211,7 @@ message MultiMatchQuery {
22112211
optional float boost = 2;
22122212

22132213
// [optional] The name of the query for query tagging.
2214-
optional string underscore_name = 3 [json_name = "_name"];
2214+
optional string underscore_name = 3;
22152215

22162216
// [optional] The analyzer used to tokenize the query string text. Default is the index-time analyzer specified for the default_field. If no analyzer is specified for the default_field, the analyzer is the default analyzer for the index. For more information about index.query.default_field, see Dynamic index-level index settings.
22172217
optional string analyzer = 4;
@@ -2636,19 +2636,19 @@ message InlineGet {
26362636

26372637
bool found = 2;
26382638

2639-
int64 seq_no = 3 [json_name = "_seq_no"];
2639+
int64 underscore_seq_no = 3;
26402640

2641-
int64 primary_term = 4 [json_name = "_primary_term"];
2641+
int64 underscore_primary_term = 4;
26422642

2643-
repeated string routing = 5 [json_name = "_routing"];
2643+
repeated string underscore_routing = 5;
26442644

26452645
oneof inline_get_source {
26462646

26472647
// struct_source field to be returned upon explicit request by user
26482648
.google.protobuf.Struct struct_source = 6;
26492649

26502650
// Use bytes for better latency/performance, as it reduces payload size over the wire
2651-
bytes source = 7 [json_name = "_source"];
2651+
bytes underscore_source = 7;
26522652

26532653
}
26542654
}

0 commit comments

Comments
 (0)