From 7286a015db6d220e86a03b635e540ba27c3e59ca Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 14 Oct 2013 12:42:56 +0200 Subject: [PATCH] The `has_child` query's inner query now is wrapped in a filtered query with the child type as filter, this prevents other children from being returned as hit. Extended the specialized simplified mapping source method to support metadata mapping fields. These fields can just specified as normal fields, but will automatically be placed as top level mapping field. Closes #3818 --- .../mapping/put/PutMappingRequest.java | 33 +++++++++- .../index/query/HasChildQueryParser.java | 4 ++ .../child/SimpleChildQuerySearchTests.java | 60 +++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java index 8433f406434..9eb3352d999 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.admin.indices.mapping.put; +import com.carrotsearch.hppc.ObjectOpenHashSet; import org.elasticsearch.ElasticSearchGenerationException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequestValidationException; @@ -52,6 +53,11 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue; */ public class PutMappingRequest extends MasterNodeOperationRequest { + private static ObjectOpenHashSet RESERVED_FIELDS = ObjectOpenHashSet.from( + "_uid", "_id", "_type", "_source", "_all", "_analyzer", "_boost", "_parent", "_routing", "_index", + "_size", "_timestamp", "_ttl" + ); + private String[] indices; private String type; @@ -125,6 +131,9 @@ public class PutMappingRequest extends MasterNodeOperationRequest