Class ElasticsearchMappings

java.lang.Object
org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings

public class ElasticsearchMappings extends Object
Static methods to create Elasticsearch index mappings for the autodetect persisted objects/documents and configurations

ElasticSearch automatically recognises array types so they are not explicitly mapped as such. For arrays of objects the type must be set to nested so the arrays are searched properly see https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html

It is expected that indexes to which these mappings are applied have their default analyzer set to "keyword", which does not tokenise fields. The index-wide default analyzer cannot be set via these mappings, so needs to be set in the index settings during index creation. For the results mapping the _all field is disabled and a custom all field is used in its place. The index settings must have "index.query.default_field": "all_field_values" set for the queries to use the custom all field. The custom all field has its analyzer set to "whitespace" by these mappings, so that it gets tokenised using whitespace.