Improve error when creating a percolator with no query, closes #669.
This commit is contained in:
parent
da9f4992e0
commit
37b1415b57
|
@ -29,6 +29,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.search.Scorer;
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Preconditions;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
|
@ -243,6 +244,7 @@ public class PercolatorExecutor extends AbstractIndexComponent {
|
|||
}
|
||||
|
||||
public synchronized void addQuery(String name, Query query) {
|
||||
Preconditions.checkArgument(query != null, "query must be provided for percolate request");
|
||||
this.queries = MapBuilder.newMapBuilder(queries).put(name, query).immutableMap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue