Skip to content

Commit 3763a16

Browse files
committed
Model index options
1 parent a170836 commit 3763a16

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

buf.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ modules:
33
- path: proto/
44
lint:
55
ignore_only:
6+
FIELD_LOWER_SNAKE_CASE:
7+
- proto/protosearch
68
PACKAGE_VERSION_SUFFIX:
79
- proto/protosearch
810
- proto/tests

proto/protosearch/protosearch.proto

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ package protosearch;
55
import "google/protobuf/descriptor.proto";
66
import "google/protobuf/struct.proto";
77

8+
extend google.protobuf.MessageOptions {
9+
optional Index index = 50000;
10+
}
11+
812
extend google.protobuf.FieldOptions {
913
optional Field field = 50000;
1014
}
@@ -36,6 +40,98 @@ enum TermVector {
3640
TERM_VECTOR_WITH_POSITIONS_OFFSETS_PAYLOADS = 7;
3741
}
3842

43+
enum SourceMode {
44+
SOURCE_MODE_UNSPECIFIED = 0;
45+
SOURCE_MODE_DISABLED = 1;
46+
SOURCE_MODE_STORED = 2;
47+
SOURCE_MODE_SYNTHETIC = 3;
48+
}
49+
50+
/**
51+
* Index represents common index parameters.
52+
*
53+
* This message does not support the `dynamic_templates` or `runtime`
54+
* parameters. This file supports explicit mappings.
55+
*/
56+
message Index {
57+
// Whether to detect date strings as `date` fields.
58+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dynamic-field-mapping#date-detection
59+
optional bool date_detection = 1;
60+
61+
// How to handle unknown fields.
62+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dynamic
63+
optional Dynamic dynamic = 2;
64+
65+
// Date formats to use for dynamic date detection.
66+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dynamic-field-mapping#dynamic-date-formats
67+
repeated string dynamic_date_formats = 3;
68+
69+
// Controls the `_field_names` metadata field.
70+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/field-names-field
71+
optional IndexFieldNames _field_names = 4;
72+
73+
// Metadata about the index mapping.
74+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-meta
75+
map<string, string> _meta = 5;
76+
77+
// Whether to detect numeric strings as numeric fields.
78+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dynamic-field-mapping#numeric-detection
79+
optional bool numeric_detection = 6;
80+
81+
// Controls the `_routing` metadata field.
82+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-routing
83+
optional IndexRouting _routing = 7;
84+
85+
// Controls the `_source` metadata field.
86+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/source-field
87+
optional IndexSource _source = 8;
88+
}
89+
90+
message IndexFieldNames {
91+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/field-names-field
92+
optional bool enabled = 1;
93+
}
94+
95+
message IndexRouting {
96+
// Whether to require routing for all document operations.
97+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-routing
98+
optional bool required = 1;
99+
}
100+
101+
message IndexSource {
102+
// Whether to compress stored source data.
103+
//
104+
// Elasticsearch: deprecated
105+
// OpenSearch: all
106+
//
107+
// https://docs.opensearch.org/latest/field-types/supported-field-types/
108+
optional bool compress = 1;
109+
110+
// Minimum source size to trigger compression.
111+
//
112+
// Elasticsearch: deprecated
113+
// OpenSearch: all
114+
//
115+
// https://docs.opensearch.org/latest/field-types/supported-field-types/
116+
optional string compress_threshold = 2;
117+
118+
// Whether to store the `_source` field.
119+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/source-field
120+
optional bool enabled = 3;
121+
122+
// Fields to exclude from the stored `_source`.
123+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/source-field
124+
repeated string excludes = 4;
125+
126+
// Fields to include in the stored `_source`.
127+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/source-field
128+
repeated string includes = 5;
129+
130+
// How to store the `_source` field.
131+
// https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/source-field
132+
optional SourceMode mode = 6;
133+
}
134+
39135
message Field {
40136
// Rename this field in the mapping.
41137
optional string name = 1;

0 commit comments

Comments
 (0)