added comment, why we fail here.

This commit is contained in:
Martijn van Groningen 2016-04-19 11:32:00 +02:00
parent 40c22fc654
commit 1a55c073e8
1 changed files with 3 additions and 0 deletions

View File

@ -177,6 +177,9 @@ public class PercolatorFieldMapper extends FieldMapper {
if (fieldMapper instanceof PercolatorFieldMapper) {
PercolatorFieldType fieldType = (PercolatorFieldType) fieldMapper.fieldType();
if (context.doc().getField(fieldType.getQueryBuilderFieldName()) != null) {
// If a percolator query has been defined in an array object then multiple percolator queries
// could be provided. In order to prevent this we fail if we try to parse more than one query
// for the current document.
throw new IllegalArgumentException("a document can only contain one percolator query");
}
}