From 317d4f687f5bbdf9b3b5ea3f0bbbb148be9cf6df Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 1 Jul 2011 20:23:19 +0300 Subject: [PATCH] fail hashing when using null type or _all --- .../routing/operation/plain/PlainOperationRouting.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java index 7b45bf08e49..00a8f243e16 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java @@ -19,6 +19,7 @@ package org.elasticsearch.cluster.routing.operation.plain; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.GroupShardsIterator; @@ -198,6 +199,9 @@ public class PlainOperationRouting extends AbstractComponent implements Operatio } protected int hash(String type, String id) { + if (type == null || "_all".equals(type)) { + throw new ElasticSearchIllegalArgumentException("Can't route an operation with no type and having type part of the routing (for backward comp)"); + } return hashFunction.hash(type, id); } }