Skip to content
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

Add a way to set array of types in match_mapping_type #102807

Closed
eyalkoren opened this issue Nov 30, 2023 · 3 comments · Fixed by #103171
Closed

Add a way to set array of types in match_mapping_type #102807

eyalkoren opened this issue Nov 30, 2023 · 3 comments · Fixed by #103171
Labels
>enhancement :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team

Comments

@eyalkoren
Copy link
Contributor

Description

In addition or instead of #102795, it would be useful to be able to set multiple input JSON types for dynamic templates' match_mapping_type, for example: "match_mapping_type": ["string", "long", "double"].
Otherwise, in order to achieve accurate dynamic templates we would need to duplicate them.
For example, consider the following use cases:

  • numeric fields, where both long and double are relevant, as well as string to allow for automatic numeric detection
  • auto detection of dates, which requires string as well as numbers (not only long, also double to support sub-millisecond-resolution representation of milliseconds)

Since the number of possible input mapping types is very small, having this capability may make unmatch_mapping_type unnecessary.

cc @axw

@eyalkoren eyalkoren added >enhancement :Search/Mapping Index mappings, including merging and defining field types needs:triage Requires assignment of a team area label labels Nov 30, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Nov 30, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@axw
Copy link
Member

axw commented Nov 30, 2023

Seems sensible to me. Also aligns with the short-term fix that I have in progress for #102794, which is to duplicate ecs_usage_scaled_float and set match_mapping_type for each of double and long.

@javanna
Copy link
Member

javanna commented Nov 30, 2023

This sounds sensible, and goes in the same direction as #66364 but for match on type.

elasticsearchmachine pushed a commit that referenced this issue Dec 12, 2023
…ic templates (#103035)

Add `match_mapping_type` to `ecs@mappings`'s `ecs_usage_scaled_float`
(now split into two) dynamic templates, to avoid matching intermediate
objects. For example, this avoids matching the `usage` object in
`system.process.cgroup.memory.mem.usage.bytes`.

This is a short term solution for #102794, to unblock using the apm-data
plugin (whose templates include `ecs@mappings`). A better solution
(compared to splitting the `ecs_usage_scaled_float` template) would be
#102807.
martijnvg pushed a commit to martijnvg/elasticsearch that referenced this issue Feb 12, 2024
Add an `unmatch_mapping_type` condition to dynamic templates (supporting
one or more types), and add support for specifying a list of types to
`match_mapping_type`.

Closes elastic#102795 Closes
elastic#102807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants