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 runtime field section to the Field Capabilities API #68117

Closed
jimczi opened this issue Jan 28, 2021 · 4 comments · Fixed by #68904
Closed

Add a runtime field section to the Field Capabilities API #68117

jimczi opened this issue Jan 28, 2021 · 4 comments · Fixed by #68904
Assignees
Labels
>feature :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@jimczi
Copy link
Contributor

jimczi commented Jan 28, 2021

Runtime fields defined in a search request will not appear in the output of the field capabilities API. Merging these runtime fields in the output of the field capabilities API is not trivial since we have some internal logic to decide the capabilities of fields based on their mappings.
In order to make it easier for Kibana, QL, ml or any consumer of runtime fields, the field capabilities API should be able to handle a runtime section just like search requests. The section would be used internally as an override in the mappings of all the indices that the request targets:

GET my_data_stream/_field_caps?fields=*
{
  "runtime_mappings": {
    "day_of_week": {
      "type": "keyword",
      "script": {
        "source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
      }
    }
  }
}

Would return all the fields present in the mapping as well as the runtime fields defined in the request (as an override if the field already exists in the index mappings).

Relates #68115

@jimczi jimczi added >feature :Search Foundations/Mapping Index mappings, including merging and defining field types labels Jan 28, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jan 28, 2021
@elasticmachine
Copy link
Collaborator

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

@przemekwitek
Copy link
Contributor

@jimczi: How is this issue going? How likely is it to be ready for 7.12?

@cbuescher cbuescher self-assigned this Feb 8, 2021
@cbuescher
Copy link
Member

@przemekwitek I recently started looking into this but cannot say for sure what the timeframe for this might be. Hopefully have an estimate soon though.

@przemekwitek
Copy link
Contributor

I recently started looking into this but cannot say for sure what the timeframe for this might be. Hopefully have an estimate soon though.

SGTM, thanks!

cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Feb 11, 2021
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the `_field_caps` endpoint, passes this section down to
the shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.

Closes elastic#68117
cbuescher pushed a commit that referenced this issue Feb 11, 2021
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the `_field_caps` endpoint, passes this section down to
the shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.

Closes #68117
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Feb 11, 2021
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the `_field_caps` endpoint, passes this section down to
the shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.

Closes elastic#68117
cbuescher pushed a commit that referenced this issue Feb 11, 2021
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the `_field_caps` endpoint, passes this section down to
the shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.

Closes #68117
@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants