From 78b266a72367e9deabd94b06471e204572e0a2c7 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Fri, 30 May 2014 14:19:39 +0200 Subject: [PATCH] Object and Type parsing: Fix include_in_all in type include_in_all can also be set on type level (root object). This fixes a regression introduced in #6093 closes #6304 --- .../elasticsearch/index/mapper/object/ObjectMapper.java | 5 +++-- .../index/mapper/all/SimpleAllMapperTests.java | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java b/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java index 00f8a0d7683e3..d19fc69d6c548 100644 --- a/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java @@ -211,6 +211,9 @@ protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, O parseProperties(builder, (Map) fieldNode, parserContext); } return true; + } else if (fieldName.equals("include_in_all")) { + builder.includeInAll(nodeBooleanValue(fieldNode)); + return true; } return false; } @@ -218,8 +221,6 @@ protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, O protected static void parseObjectProperties(String name, String fieldName, Object fieldNode, ObjectMapper.Builder builder) { if (fieldName.equals("path")) { builder.pathType(parsePathType(name, fieldNode.toString())); - } else if (fieldName.equals("include_in_all")) { - builder.includeInAll(nodeBooleanValue(fieldNode)); } } diff --git a/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java index d262b079182f9..87500271afc14 100644 --- a/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java @@ -367,6 +367,13 @@ public void testRootMappersStillWorking() { rootTypes.put(IndexFieldMapper.NAME, "{\"enabled\" : true}"); rootTypes.put(SourceFieldMapper.NAME, "{\"enabled\" : true}"); rootTypes.put(TypeFieldMapper.NAME, "{\"store\" : true}"); + rootTypes.put("include_in_all", "true"); + rootTypes.put("index_analyzer", "\"standard\""); + rootTypes.put("search_analyzer", "\"standard\""); + rootTypes.put("analyzer", "\"standard\""); + rootTypes.put("dynamic_date_formats", "[\"yyyy-MM-dd\", \"dd-MM-yyyy\"]"); + rootTypes.put("numeric_detection", "true"); + rootTypes.put("dynamic_templates", "[]"); for (String key : rootTypes.keySet()) { mapping += "\"" + key+ "\"" + ":" + rootTypes.get(key) + ",\n"; }