better exception when trying to put mappings when no indices exists, closes #79.
This commit is contained in:
parent
f9cac39024
commit
89043b113a
|
@ -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 {
|
public synchronized PutMappingResult putMapping(final String[] indices, String mappingType, final String mappingSource, boolean ignoreConflicts, TimeValue timeout) throws ElasticSearchException {
|
||||||
ClusterState clusterState = clusterService.state();
|
ClusterState clusterState = clusterService.state();
|
||||||
|
if (indices.length == 0) {
|
||||||
|
throw new IndexMissingException(new Index("_all"));
|
||||||
|
}
|
||||||
for (String index : indices) {
|
for (String index : indices) {
|
||||||
IndexRoutingTable indexTable = clusterState.routingTable().indicesRouting().get(index);
|
IndexRoutingTable indexTable = clusterState.routingTable().indicesRouting().get(index);
|
||||||
if (indexTable == null) {
|
if (indexTable == null) {
|
||||||
|
|
Loading…
Reference in New Issue