better exception when trying to put mappings when no indices exists, closes #79.

This commit is contained in:
kimchy 2010-03-22 18:03:05 +02:00
parent f9cac39024
commit 89043b113a
1 changed files with 3 additions and 0 deletions

View File

@ -244,6 +244,9 @@ public class MetaDataService extends AbstractComponent {
public synchronized PutMappingResult putMapping(final String[] indices, String mappingType, final String mappingSource, boolean ignoreConflicts, TimeValue timeout) throws ElasticSearchException {
ClusterState clusterState = clusterService.state();
if (indices.length == 0) {
throw new IndexMissingException(new Index("_all"));
}
for (String index : indices) {
IndexRoutingTable indexTable = clusterState.routingTable().indicesRouting().get(index);
if (indexTable == null) {