This PR introduces the lookup runtime fields which are used to retrieve
data from the related indices. The below search request enriches its
search hits with the location of each IP address from the `ip_location`
index.
```
POST logs/_search
{
"runtime_mappings": {
"location": {
"type": "lookup",
"lookup_index": "ip_location",
"query_type": "term",
"query_input_field": "ip",
"query_target_field": "_id",
"fetch_fields": [
"country",
"city"
]
}
},
"fields": [
"timestamp",
"message",
"location"
]
}
```
Response:
```
{
"hits": {
"hits": [
{
"_index": "logs",
"_id": "1",
"fields": {
"location": [
{
"city": [ "Montreal" ],
"country": [ "Canada" ]
}
],
"message": [ "the first message" ]
}
}
]
}
}
```
XContentMapValues.extractRawValues() contains a hack whereby we
ignore extra 'dummy' dotted path values appended to a source path - ie,
loading data from foo.bar.dummy will also load from foo.bar. This was
used to implement source loading for multifields, which do not have a name
that corresponds to an existing path in source data. This was safe in general
because you can't have a field that is a dot prefix of another field in index
mappings.
With runtime fields, however, this changes. You can define scriptless runtime
fields for both foo.bar and foo.bar.dummy, and it is important that the
latter does not pick up values from the former path.
Source loading for multifield highlighting has already moved away from using
this hack by loading everything through value fetchers. This commit removes
the hack entirely, and updates term vector loading to use a value fetcher
as well
As a follow-up of moving runtime fields to server, we would like to remove the runtime field xpack plugin portions that are left.
This commit moves the runtime-fields/qa module to x-pack/qa/runtime-fields. Runtime fields are no longer part of x-pack, but their qa tests involve testing with security, async search, which require x-pack, hence their qa tests are left under x-pack.