-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Add per-field metadata. #49419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add per-field metadata. #49419
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d39adbe
Add per-field metadata.
jpountz 8327d1b
Fix bad ref.
jpountz 931476c
Fix REST tests to work in BWC tests.
jpountz 097d49c
iter
jpountz 5319b64
Address review comments.
jpountz e50d03e
Merge branch 'master' into feature/per_field_meta
jpountz 3c1e60f
Merge branch 'master' into feature/per_field_meta
jpountz 48ae2a6
Add support for histogram fields and a REST test that meta can be upd…
jpountz 08415e1
Merge branch 'master' into feature/per_field_meta
jpountz 59e573c
iter
jpountz 0afbd07
Merge branch 'master' into feature/per_field_meta
jpountz d2f490e
Feedback.
jpountz ba2b9ac
iter
jpountz f7425ff
Document that mapping updates override metadata.
jpountz 66f1f7f
Merge branch 'master' into feature/per_field_meta
jpountz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[[mapping-field-meta]] | ||
=== `meta` | ||
|
||
Metadata attached to the field. This metadata is opaque to Elasticsearch, it is | ||
only useful for multiple applications that work on the same indices to share | ||
meta information about fields such as units | ||
|
||
[source,console] | ||
------------ | ||
PUT my_index | ||
{ | ||
"mappings": { | ||
"properties": { | ||
"latency": { | ||
"type": "long", | ||
"meta": { | ||
"unit": "ms" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
------------ | ||
// TEST | ||
|
||
NOTE: Field metadata enforces that keys have a length that is less than or | ||
equal to 20, and that values are either numbers or strings whose length is less | ||
than or equal to 50. | ||
mayya-sharipova marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
rest-api-spec/src/main/resources/rest-api-spec/test/field_caps/20_meta.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
"Merge metadata across multiple indices": | ||
|
||
- skip: | ||
version: " - 7.99.99" | ||
reason: Metadata support was added in 7.6 | ||
|
||
- do: | ||
indices.create: | ||
index: test1 | ||
body: | ||
mappings: | ||
properties: | ||
latency: | ||
type: long | ||
meta: | ||
unit: ms | ||
mayya-sharipova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- do: | ||
indices.create: | ||
index: test2 | ||
body: | ||
mappings: | ||
properties: | ||
latency: | ||
type: long | ||
meta: | ||
unit: ns | ||
- do: | ||
indices.create: | ||
index: test3 | ||
|
||
- do: | ||
field_caps: | ||
index: test3 | ||
fields: [latency] | ||
|
||
- is_false: fields.latency.long.meta.unit | ||
|
||
- do: | ||
field_caps: | ||
index: test1 | ||
fields: [latency] | ||
|
||
- match: {fields.latency.long.meta.unit: ["ms"]} | ||
|
||
- do: | ||
field_caps: | ||
index: test1,test3 | ||
fields: [latency] | ||
|
||
- match: {fields.latency.long.meta.unit: ["ms"]} | ||
|
||
- do: | ||
field_caps: | ||
index: test1,test2,test3 | ||
fields: [latency] | ||
|
||
- match: {fields.latency.long.meta.unit: ["ms", "ns"]} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the other parameters are listed in alphabetical order.