From 1ae8ed495eb42ebcf5b1c1e92b83a07b1547d525 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Thu, 16 Feb 2017 17:53:26 +0000 Subject: [PATCH] [ML] Add keyword mapping to audit message to enable aggs (elastic/x-pack-elasticsearch#583) The messages stored in the .ml-notifications index include a message field that is mapped to text. It makes sense to keep that mapping as it can improve search experience in messages. However, the ML kibana app needs to aggregate over messages, thus we also need to provide a keyword mapping. Original commit: elastic/x-pack-elasticsearch@5a5df53d85cdebc4aa4622268a1c7bd86ed824a9 --- .../xpack/ml/job/persistence/ElasticsearchMappings.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java index 7c39d90e2ec..e423a5c406b 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ElasticsearchMappings.java @@ -63,6 +63,7 @@ public class ElasticsearchMappings { static final String PROPERTIES = "properties"; static final String TYPE = "type"; static final String DYNAMIC = "dynamic"; + static final String FIELDS = "fields"; /** * Name of the custom 'all' field for results @@ -85,6 +86,8 @@ public class ElasticsearchMappings { static final String LONG = "long"; static final String TEXT = "text"; + static final String RAW = "raw"; + private ElasticsearchMappings() { } @@ -657,6 +660,11 @@ public class ElasticsearchMappings { .endObject() .startObject(AuditMessage.MESSAGE.getPreferredName()) .field(TYPE, TEXT) + .startObject(FIELDS) + .startObject(RAW) + .field(TYPE, KEYWORD) + .endObject() + .endObject() .endObject() .startObject(AuditMessage.TIMESTAMP.getPreferredName()) .field(TYPE, DATE)