In some cases the Enrich processor factory may be called before it is ready to create processors. While these calls are usually made in error, the response from the Enrich processor is an NPE which is almost always an unhelpful error when debugging an issue.
This commit is contained in:
parent
c8278e333a
commit
4809db3ff9
|
@ -38,6 +38,9 @@ final class EnrichProcessorFactory implements Processor.Factory, Consumer<Cluste
|
|||
public Processor create(Map<String, Processor.Factory> processorFactories, String tag, Map<String, Object> config) throws Exception {
|
||||
String policyName = ConfigurationUtils.readStringProperty(TYPE, tag, config, "policy_name");
|
||||
String policyAlias = EnrichPolicy.getBaseName(policyName);
|
||||
if (metadata == null) {
|
||||
throw new IllegalStateException("enrich processor factory has not yet been initialized with cluster state");
|
||||
}
|
||||
IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(policyAlias);
|
||||
if (indexAbstraction == null) {
|
||||
throw new IllegalArgumentException("no enrich index exists for policy with name [" + policyName + "]");
|
||||
|
|
Loading…
Reference in New Issue