diff --git a/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json index 9f2c467decc..6ed747e3c17 100644 --- a/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json +++ b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json @@ -15,8 +15,7 @@ "date_detection": false, "properties": { "cluster_uuid": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "timestamp": { "type": "date", @@ -25,24 +24,19 @@ "source_node": { "properties": { "uuid": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "host": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "transport_address": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "ip": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "name": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "attributes": { "dynamic": true, @@ -101,8 +95,7 @@ "index_stats": { "properties": { "index": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "primaries": { "properties": { @@ -274,16 +267,13 @@ "type": "long" }, "master_node": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "state_uuid": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "status": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "nodes": { "enabled": false @@ -298,14 +288,12 @@ "node": { "properties": { "state_uuid": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "node": { "properties": { "id": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -316,8 +304,7 @@ "node_stats": { "properties": { "node_id": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "node_master": { "type": "boolean" @@ -363,36 +350,31 @@ "shards": { "properties": { "state_uuid": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "shard": { "properties": { "state": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "primary": { "type": "boolean" }, "index": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "relocating_node": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "shard": { "type": "long" }, "node": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } } } } -} \ No newline at end of file +} diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java index d262dbb2df2..9c7ec2893bd 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java @@ -187,8 +187,7 @@ public abstract class AbstractExporterTemplateTestCase extends MarvelIntegTestCa .field("date_detection", false) .startObject("properties") .startObject("cluster_uuid") - .field("type", "string") - .field("index", "not_analyzed") + .field("type", "keyword") .endObject() .startObject("timestamp") .field("type", "date") diff --git a/elasticsearch/x-pack/shield/src/main/resources/security-index-template.json b/elasticsearch/x-pack/shield/src/main/resources/security-index-template.json index ff4f588a79f..42ec085e8e9 100644 --- a/elasticsearch/x-pack/shield/src/main/resources/security-index-template.json +++ b/elasticsearch/x-pack/shield/src/main/resources/security-index-template.json @@ -35,24 +35,21 @@ "dynamic" : "strict", "properties" : { "username" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "roles" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "password" : { - "type" : "string", - "index" : "no" + "type" : "keyword", + "index" : false, + "doc_values": false }, "full_name" : { - "type" : "string", - "index" : "analyzed" + "type" : "text" }, "email" : { - "type" : "string", - "index" : "analyzed", + "type" : "text", "analyzer" : "email" }, "metadata" : { @@ -65,37 +62,30 @@ "dynamic" : "strict", "properties" : { "cluster" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "indices" : { "type" : "object", "properties" : { "fields" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "names" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "privileges" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "query" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" } } }, "name" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "run_as" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" } } } diff --git a/elasticsearch/x-pack/shield/src/main/resources/shield_audit_log.json b/elasticsearch/x-pack/shield/src/main/resources/shield_audit_log.json index 9a8b22b8896..cb7f86602c8 100644 --- a/elasticsearch/x-pack/shield/src/main/resources/shield_audit_log.json +++ b/elasticsearch/x-pack/shield/src/main/resources/shield_audit_log.json @@ -17,93 +17,60 @@ "doc_values": true }, "node_name": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "node_host_name": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "node_host_address": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "layer": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "event_type": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "origin_address": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "origin_type": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "principal": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "run_by_principal": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "run_as_principal": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "action": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "indices": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "request": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "request_body": { - "type": "string", - "index": "no" + "type": "keyword", + "index": false, + "doc_values": false }, "uri": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "realm": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "transport_profile": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" }, "rule": { - "type": "string", - "index": "not_analyzed", - "doc_values": true + "type": "keyword" } } } diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentAndFieldLevelSecurityTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentAndFieldLevelSecurityTests.java index bbdbcba113d..89c6ad8fd49 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentAndFieldLevelSecurityTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentAndFieldLevelSecurityTests.java @@ -84,7 +84,7 @@ public class DocumentAndFieldLevelSecurityTests extends ShieldIntegTestCase { public void testSimpleQuery() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -123,7 +123,7 @@ public class DocumentAndFieldLevelSecurityTests extends ShieldIntegTestCase { public void testQueryCache() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") .setSettings(Settings.builder().put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true)) - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityRandomTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityRandomTests.java index 9d1f06067dc..5616cd40ba0 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityRandomTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityRandomTests.java @@ -81,7 +81,7 @@ public class DocumentLevelSecurityRandomTests extends ShieldIntegTestCase { public void testDuelWithAliasFilters() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") ); List requests = new ArrayList<>(numberOfRoles); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java index 38b6475eeaa..0c0a45003c4 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java @@ -97,7 +97,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testSimpleQuery() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -138,7 +138,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testGetApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1").get(); @@ -203,7 +203,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testMGetApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1").get(); @@ -276,9 +276,9 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testTVApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string,term_vector=with_positions_offsets_payloads", - "field2", "type=string,term_vector=with_positions_offsets_payloads", - "field3", "type=string,term_vector=with_positions_offsets_payloads") + .addMapping("type1", "field1", "type=text,term_vector=with_positions_offsets_payloads", + "field2", "type=text,term_vector=with_positions_offsets_payloads", + "field3", "type=text,term_vector=with_positions_offsets_payloads") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -341,9 +341,9 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testMTVApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string,term_vector=with_positions_offsets_payloads", - "field2", "type=string,term_vector=with_positions_offsets_payloads", - "field3", "type=string,term_vector=with_positions_offsets_payloads") + .addMapping("type1", "field1", "type=text,term_vector=with_positions_offsets_payloads", + "field2", "type=text,term_vector=with_positions_offsets_payloads", + "field3", "type=text,term_vector=with_positions_offsets_payloads") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -408,7 +408,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testGlobalAggregation() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -471,8 +471,8 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testChildrenAggregation() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") - .addMapping("type2", "_parent", "type=type1", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") + .addMapping("type2", "_parent", "type=type1", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .setRefresh(true) @@ -528,7 +528,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testParentChild() { assertAcked(prepareCreate("test") .addMapping("parent") - .addMapping("child", "_parent", "type=parent", "field1", "type=string", "field2", "type=string", "field3", "type=string")); + .addMapping("child", "_parent", "type=parent", "field1", "type=text", "field2", "type=text", "field3", "type=text")); ensureGreen(); // index simple data @@ -597,7 +597,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testPercolateApi() { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping(".percolator", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping(".percolator", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", ".percolator", "1") .setSource("{\"query\" : { \"match_all\" : {} }, \"field1\" : \"value1\"}") @@ -678,7 +678,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testRequestCache() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") .setSettings(Settings.builder().put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)) - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1") .get(); @@ -721,7 +721,7 @@ public class DocumentLevelSecurityTests extends ShieldIntegTestCase { public void testUpdateApiIsBlocked() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type", "field1", "type=string", "field2", "type=string") + .addMapping("type", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type", "1").setSource("field1", "value1") .setRefresh(true) diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityRandomTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityRandomTests.java index d7a13cd6b43..adad07b7771 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityRandomTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityRandomTests.java @@ -122,12 +122,12 @@ public class FieldLevelSecurityRandomTests extends ShieldIntegTestCase { String[] fieldMappers = new String[(allowedFields.size() + disAllowedFields.size()) * 2]; for (String field : allowedFields) { fieldMappers[j++] = field; - fieldMappers[j++] = "type=string"; + fieldMappers[j++] = "type=text"; doc.put(field, "value"); } for (String field : disAllowedFields) { fieldMappers[j++] = field; - fieldMappers[j++] = "type=string"; + fieldMappers[j++] = "type=text"; doc.put(field, "value"); } assertAcked(client().admin().indices().prepareCreate("test") @@ -157,7 +157,7 @@ public class FieldLevelSecurityRandomTests extends ShieldIntegTestCase { public void testDuel() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); int numDocs = scaledRandomIntBetween(32, 128); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java index 5ab9c61aaf5..9f475650b7b 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java @@ -126,7 +126,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testQuery() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -266,7 +266,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testGetApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") @@ -364,7 +364,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testMGetApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3").get(); @@ -476,7 +476,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testFieldStatsApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -558,7 +558,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testQueryCache() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") .setSettings(Settings.builder().put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true)) - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -596,7 +596,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testRequestCache() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") .setSettings(Settings.builder().put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)) - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2") .setRefresh(true) @@ -637,8 +637,8 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testFields() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string,store=true", "field2", "type=string,store=true", - "field3", "type=string,store=true") + .addMapping("type1", "field1", "type=text,store=true", "field2", "type=text,store=true", + "field3", "type=text,store=true") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -735,7 +735,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testSource() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string", "field3", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text", "field3", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -847,7 +847,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testAggs() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2") .setRefresh(true) @@ -885,9 +885,9 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testTVApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string,term_vector=with_positions_offsets_payloads", - "field2", "type=string,term_vector=with_positions_offsets_payloads", - "field3", "type=string,term_vector=with_positions_offsets_payloads") + .addMapping("type1", "field1", "type=text,term_vector=with_positions_offsets_payloads", + "field2", "type=text,term_vector=with_positions_offsets_payloads", + "field3", "type=text,term_vector=with_positions_offsets_payloads") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -969,9 +969,9 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testMTVApi() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string,term_vector=with_positions_offsets_payloads", - "field2", "type=string,term_vector=with_positions_offsets_payloads", - "field3", "type=string,term_vector=with_positions_offsets_payloads") + .addMapping("type1", "field1", "type=text,term_vector=with_positions_offsets_payloads", + "field2", "type=text,term_vector=with_positions_offsets_payloads", + "field3", "type=text,term_vector=with_positions_offsets_payloads") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2", "field3", "value3") .setRefresh(true) @@ -1061,7 +1061,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testPercolateApi() { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping(".percolator", "field1", "type=string", "field2", "type=string") + .addMapping(".percolator", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", ".percolator", "1") .setSource("{\"query\" : { \"match_all\" : {} }, \"field1\" : \"value1\"}") @@ -1133,7 +1133,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testUpdateApiIsBlocked() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type", "field1", "type=string", "field2", "type=string") + .addMapping("type", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type", "1") .setSource("field1", "value1", "field2", "value1") @@ -1179,7 +1179,7 @@ public class FieldLevelSecurityTests extends ShieldIntegTestCase { public void testQuery_withRoleWithFieldWildcards() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") ); client().prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2") .setRefresh(true) diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/IndicesPermissionsWithAliasesWildcardsAndRegexsTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/IndicesPermissionsWithAliasesWildcardsAndRegexsTests.java index c2c8639c6ae..7472f30a52a 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/IndicesPermissionsWithAliasesWildcardsAndRegexsTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/IndicesPermissionsWithAliasesWildcardsAndRegexsTests.java @@ -67,7 +67,7 @@ public class IndicesPermissionsWithAliasesWildcardsAndRegexsTests extends Shield public void testResolveWildcardsRegexs() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .addMapping("type1", "field1", "type=string", "field2", "type=string") + .addMapping("type1", "field1", "type=text", "field2", "type=text") .addAlias(new Alias("my_alias")) .addAlias(new Alias("an_alias")) ); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java index 2a25a8428c0..c31d90b4d04 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java @@ -153,12 +153,12 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { public void testWildcards() throws Exception { XContentBuilder mappingSource = jsonBuilder().startObject().startObject("type").startObject("properties") - .startObject("field1_a").field("type", "string").endObject() - .startObject("field1_b").field("type", "string").endObject() - .startObject("field1_c").field("type", "string").endObject() - .startObject("field2_a").field("type", "string").endObject() - .startObject("field2_b").field("type", "string").endObject() - .startObject("field2_c").field("type", "string").endObject() + .startObject("field1_a").field("type", "text").endObject() + .startObject("field1_b").field("type", "text").endObject() + .startObject("field1_c").field("type", "text").endObject() + .startObject("field2_a").field("type", "text").endObject() + .startObject("field2_b").field("type", "text").endObject() + .startObject("field2_c").field("type", "text").endObject() .endObject().endObject().endObject(); mapperService.merge("type", new CompressedXContent(mappingSource.string()), MapperService.MergeReason.MAPPING_UPDATE, false); @@ -171,22 +171,22 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { .startObject("foo") .field("type", "object") .startObject("properties") - .startObject("bar").field("type", "string").endObject() - .startObject("baz").field("type", "string").endObject() + .startObject("bar").field("type", "text").endObject() + .startObject("baz").field("type", "text").endObject() .endObject() .endObject() .startObject("bar") .field("type", "object") .startObject("properties") - .startObject("foo").field("type", "string").endObject() - .startObject("baz").field("type", "string").endObject() + .startObject("foo").field("type", "text").endObject() + .startObject("baz").field("type", "text").endObject() .endObject() .endObject() .startObject("baz") .field("type", "object") .startObject("properties") - .startObject("bar").field("type", "string").endObject() - .startObject("foo").field("type", "string").endObject() + .startObject("bar").field("type", "text").endObject() + .startObject("foo").field("type", "text").endObject() .endObject() .endObject() .endObject().endObject().endObject(); @@ -201,13 +201,13 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { public void testParentChild() throws Exception { XContentBuilder mappingSource = jsonBuilder().startObject().startObject("parent1") .startObject("properties") - .startObject("field").field("type", "string").endObject() + .startObject("field").field("type", "text").endObject() .endObject() .endObject().endObject(); mapperService.merge("parent1", new CompressedXContent(mappingSource.string()), MapperService.MergeReason.MAPPING_UPDATE, false); mappingSource = jsonBuilder().startObject().startObject("child1") .startObject("properties") - .startObject("field").field("type", "string").endObject() + .startObject("field").field("type", "text").endObject() .endObject() .startObject("_parent") .field("type", "parent1") @@ -216,7 +216,7 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { mapperService.merge("child1", new CompressedXContent(mappingSource.string()), MapperService.MergeReason.MAPPING_UPDATE, false); mappingSource = jsonBuilder().startObject().startObject("child2") .startObject("properties") - .startObject("field").field("type", "string").endObject() + .startObject("field").field("type", "text").endObject() .endObject() .startObject("_parent") .field("type", "parent1") @@ -225,13 +225,13 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { mapperService.merge("child2", new CompressedXContent(mappingSource.string()), MapperService.MergeReason.MAPPING_UPDATE, false); mappingSource = jsonBuilder().startObject().startObject("parent2") .startObject("properties") - .startObject("field").field("type", "string").endObject() + .startObject("field").field("type", "text").endObject() .endObject() .endObject().endObject(); mapperService.merge("parent2", new CompressedXContent(mappingSource.string()), MapperService.MergeReason.MAPPING_UPDATE, false); mappingSource = jsonBuilder().startObject().startObject("child3") .startObject("properties") - .startObject("field").field("type", "string").endObject() + .startObject("field").field("type", "text").endObject() .endObject() .startObject("_parent") .field("type", "parent2") diff --git a/elasticsearch/x-pack/watcher/src/main/resources/triggered_watches.json b/elasticsearch/x-pack/watcher/src/main/resources/triggered_watches.json index 676e642dfc0..50ab9e1521a 100644 --- a/elasticsearch/x-pack/watcher/src/main/resources/triggered_watches.json +++ b/elasticsearch/x-pack/watcher/src/main/resources/triggered_watches.json @@ -33,10 +33,9 @@ } }, "state": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } } -} \ No newline at end of file +} diff --git a/elasticsearch/x-pack/watcher/src/main/resources/watch_history.json b/elasticsearch/x-pack/watcher/src/main/resources/watch_history.json index 57470bb9afc..9c5a8578858 100644 --- a/elasticsearch/x-pack/watcher/src/main/resources/watch_history.json +++ b/elasticsearch/x-pack/watcher/src/main/resources/watch_history.json @@ -37,16 +37,14 @@ }, "properties": { "watch_id": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "trigger_event": { "type": "object", "dynamic": true, "properties": { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "triggered_time": { "type": "date" @@ -90,11 +88,10 @@ "enabled": false }, "state": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "messages": { - "type": "string" + "type": "text" }, "result": { "type": "object", @@ -111,12 +108,10 @@ "dynamic": true, "properties": { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "status" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "payload" : { "type" : "object", @@ -131,16 +126,13 @@ "dynamic": true, "properties": { "search_type": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "indices": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "types": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -155,12 +147,10 @@ "dynamic": true, "properties": { "path": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "host": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -173,12 +163,10 @@ "dynamic" : true, "properties" : { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "status" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "met" : { "type" : "boolean" @@ -202,8 +190,7 @@ "dynamic" : true, "properties" : { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "search" : { "type" : "object", @@ -214,12 +201,10 @@ "dynamic" : true, "properties" : { "indices" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "types" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" } } } @@ -233,20 +218,16 @@ "dynamic": true, "properties": { "id" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "status" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "reason" : { - "type" : "string", - "index" : "analyzed" + "type" : "keyword" }, "email": { "type": "object", @@ -257,28 +238,22 @@ "dynamic": true, "properties": { "id": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "from": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "reply_to": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "to": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "cc": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "bcc": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -293,12 +268,10 @@ "dynamic": true, "properties": { "path": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "host": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -313,16 +286,13 @@ "dynamic": true, "properties": { "index": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "type": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "id": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" } } } @@ -333,8 +303,7 @@ "dynamic": true, "properties": { "account": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "sent_messages": { "type": "nested", @@ -342,11 +311,10 @@ "dynamic": true, "properties": { "status": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "reason": { - "type": "string" + "type": "text" }, "request" : { "type" : "object", @@ -357,33 +325,29 @@ "enabled" : false }, "room" : { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "user" : { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "message" : { "type" : "object", "dynamic" : true, "properties" : { "message_format" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "color" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "notify" : { "type" : "boolean" }, "message" : { - "type" : "string" + "type" : "text" }, "from" : { - "type" : "string" + "type" : "text" } } } @@ -396,8 +360,7 @@ "dynamic": true, "properties": { "account": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "sent_messages": { "type": "nested", @@ -405,11 +368,10 @@ "dynamic": true, "properties": { "status": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "reason": { - "type": "string" + "type": "text" }, "request" : { "type" : "object", @@ -420,22 +382,20 @@ "enabled" : false }, "to" : { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "message" : { "type" : "object", "dynamic" : true, "properties" : { "from" : { - "type" : "string" + "type" : "text" }, "icon" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "text" : { - "type" : "string" + "type" : "text" }, "attachments" : { "type" : "nested", @@ -443,8 +403,7 @@ "dynamic" : true, "properties" : { "color" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" } } } @@ -459,8 +418,7 @@ "dynamic": true, "properties": { "account": { - "type": "string", - "index": "not_analyzed" + "type": "keyword" }, "sent_event": { "type": "nested", @@ -468,7 +426,7 @@ "dynamic": true, "properties": { "reason": { - "type": "string" + "type": "text" }, "request" : { "type" : "object", @@ -483,29 +441,25 @@ "dynamic" : true, "properties" : { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "client" : { - "type" : "string" + "type" : "text" }, "client_url" : { - "index" : "not_analyzed", - "type" : "string" + "type" : "keyword" }, "account" : { - "index" : "not_analyzed", - "type" : "string" + "type" : "keyword" }, "attach_payload" : { "type" : "boolean" }, "incident_key" : { - "index" : "not_analyzed", - "type" : "string" + "type" : "keyword" }, "description" : { - "type" : "string" + "type" : "text" }, "context" : { "type" : "nested", @@ -513,19 +467,16 @@ "dynamic" : true, "properties" : { "type" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "href" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "src" : { - "type" : "string", - "index" : "not_analyzed" + "type" : "keyword" }, "alt" : { - "type" : "string" + "type" : "text" } } } @@ -546,4 +497,4 @@ } } } -} \ No newline at end of file +} diff --git a/elasticsearch/x-pack/watcher/src/main/resources/watches.json b/elasticsearch/x-pack/watcher/src/main/resources/watches.json index e523a57ee2d..87e11945400 100644 --- a/elasticsearch/x-pack/watcher/src/main/resources/watches.json +++ b/elasticsearch/x-pack/watcher/src/main/resources/watches.json @@ -33,8 +33,9 @@ "dynamic" : true }, "throttle_period": { - "type": "string", - "index" : "no" + "type" : "keyword", + "index" : false, + "doc_values" : false }, "transform": { "type" : "object", @@ -53,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/history/HistoryTemplateTimeMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/history/HistoryTemplateTimeMappingsTests.java index ae30a15c72c..4cf6bc3b7e7 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/history/HistoryTemplateTimeMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/history/HistoryTemplateTimeMappingsTests.java @@ -71,8 +71,7 @@ public class HistoryTemplateTimeMappingsTests extends AbstractWatcherIntegration try { Map source = metadata.getSourceAsMap(); logger.info("checking index [{}] with metadata:\n[{}]", metadatas.key, metadata.source().toString()); - assertThat(extractValue("properties.trigger_event.properties.type.type", source), is((Object) "string")); - assertThat(extractValue("properties.trigger_event.properties.type.index", source), is((Object) "not_analyzed")); + assertThat(extractValue("properties.trigger_event.properties.type.type", source), is((Object) "keyword")); assertThat(extractValue("properties.trigger_event.properties.triggered_time.type", source), is((Object) "date")); assertThat(extractValue("properties.trigger_event.properties.schedule.properties.scheduled_time.type", source), is((Object) "date")); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java index e45f16df4e8..d97157a1da2 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java @@ -385,7 +385,7 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase { timeWarp().clock().setTime(SystemClock.INSTANCE.nowUTC()); String watchName = "_name"; - assertAcked(prepareCreate("events").addMapping("event", "_timestamp", "enabled=true", "level", "type=string")); + assertAcked(prepareCreate("events").addMapping("event", "_timestamp", "enabled=true", "level", "type=text")); watcherClient().preparePutWatch(watchName) .setSource(watchBuilder()