Closed
Description
Java API client version
7.17.10
Java version
17
Elasticsearch Version
7.17.1
Problem description
The Property object does not support the script field for mapping types, e.g. keyword
or date
:
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/keyword.html
script | If this parameter is set, then the field will index values generated by this script, rather than reading the values directly from the source. If a value is set for this field on the input document, then the document will be rejected with an error. Scripts are in the same format as their runtime equivalent. Values emitted by the script are normalized as usual, and will be ignored if they are longer that the value set on ignore_above. |
---|
I would expect something like this snippet to work:
String mapping = """
{
"properties": {
"foo": {
"type": "keyword",
"script": "emit(params['_source']['id'].substring(0, 10))"
}
}
}
""";
client
.indices()
.create(cb -> cb.mappings(mb -> mb.withJson(new StringReader(mapping)))
And looking at the docs, there are a LOT of missing fields -- IMHO, an architecture change that allows overriding or providing additional arbitrary Map<String, Json>
to overlay on any of the JsonP shapes would go a LONG way to allow working around all these shortcomings :|