-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>enhancementTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
Once we have added support for runtime fields added to index mappings (#59332), we'd like to make it possible to make them available in the context of a specific search request. A new section of the search request would be added, which allows to create runtime fields on-the-fly. In that case such fields are available only within the execution of that specific search request.
The following is an example of how a runtime scripted field can be made available in the context of a search request:
GET my_index/_search
{
"runtime_mappings": {
"age": {
"type" : "runtime_script",
"runtime_type": "integer",
"script": {
"source" : "now - doc['date_of_birth'].value"
}
}
},
"query": {
"range" : {
"age" : {
"gte" : 10,
"lte" : 20
}
}
},
"sort" : ["age"],
"aggs" : {
"age" : {
"terms" : {
"field" : "age"
}
}
}
}
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>enhancementTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch