OpenSearch/x-pack/plugin
Adrien Grand 31158ab3d5
Add per-field metadata. (#50333)
This PR adds per-field metadata that can be set in the mappings and is later
returned by the field capabilities API. This metadata is completely opaque to
Elasticsearch but may be used by tools that index data in Elasticsearch to
communicate metadata about fields with tools that then search this data. A
typical example that has been requested in the past is the ability to attach
a unit to a numeric field.

In order to not bloat the cluster state, Elasticsearch requires that this
metadata be small:
 - keys can't be longer than 20 chars,
 - values can only be numbers or strings of no more than 50 chars - no inner
   arrays or objects,
 - the metadata can't have more than 5 keys in total.

Given that metadata is opaque to Elasticsearch, field capabilities don't try to
do anything smart when merging metadata about multiple indices, the union of
all field metadatas is returned.

Here is how the meta might look like in mappings:

```json
{
  "properties": {
    "latency": {
      "type": "long",
      "meta": {
        "unit": "ms"
      }
    }
  }
}
```

And then in the field capabilities response:

```json
{
  "latency": {
    "long": {
      "searchable": true,
      "aggreggatable": true,
      "meta": {
        "unit": [ "ms" ]
      }
    }
  }
}
```

When there are no conflicts, values are arrays of size 1, but when there are
conflicts, Elasticsearch includes all unique values in this array, without
giving ways to know which index has which metadata value:

```json
{
  "latency": {
    "long": {
      "searchable": true,
      "aggreggatable": true,
      "meta": {
        "unit": [ "ms", "ns" ]
      }
    }
  }
}
```

Closes #33267
2020-01-08 16:21:18 +01:00
..
analytics Add per-field metadata. (#50333) 2020-01-08 16:21:18 +01:00
ccr Make some ObjectParsers final (#50471) (#50556) 2020-01-02 10:47:38 -05:00
core Make the UpdateRolloverLifecycleDateStep retryable (#50702) (#50730) 2020-01-08 11:45:26 +01:00
deprecation Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
enrich Backport: Fix ingest simulate response document order if processor executes async (#50269) 2019-12-17 12:27:07 +01:00
frozen-indices Use more specific loggers in subclasses of TMNA (#50076) 2019-12-11 15:07:47 +00:00
graph Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
ilm Make the UpdateRolloverLifecycleDateStep retryable (#50702) (#50730) 2020-01-08 11:45:26 +01:00
logstash Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
mapper-flattened Add telemetry for flattened fields. (#48972) (#49125) 2019-11-18 12:29:42 -08:00
ml Add per-field metadata. (#50333) 2020-01-08 16:21:18 +01:00
monitoring [7.x] Add ILM histore store index (#50287) (#50345) 2019-12-20 12:33:36 -07:00
rollup Use more specific loggers in subclasses of TMNA (#50076) 2019-12-11 15:07:47 +00:00
search-business-rules Use Void context on parsers where possible (#50573) (#50617) 2020-01-03 13:28:55 -05:00
security Security should not reload files that haven't changed (#50724) 2020-01-08 15:13:47 +11:00
spatial Geo: Switch generated GeoJson type names to camel case (#50400) 2019-12-20 15:37:22 -05:00
sql Add per-field metadata. (#50333) 2020-01-08 16:21:18 +01:00
src/test Remove _reload_search_analyzer experimental status (#50696) 2020-01-08 10:35:19 +01:00
transform [Transform] improve checkpoint reporting (#50369) 2019-12-20 10:49:53 +01:00
vectors Increase the number of vector dims to 2048 (#46895) 2019-11-20 07:47:33 -05:00
voting-only-node Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
watcher Don't dump a stacktrace for invalid patterns when executing elasticsearch-croneval (#49744) (#50578) 2020-01-02 16:57:51 -07:00
build.gradle Skip enterprise license tests in release build (#50182) 2019-12-16 10:11:21 +11:00