|
@@ -36,7 +36,6 @@ import org.apache.lucene.util.BytesRef;
|
|
|
import org.apache.lucene.util.automaton.Automaton;
|
|
|
import org.apache.lucene.util.automaton.RegExp;
|
|
|
import org.apache.lucene.util.automaton.RegExp.Kind;
|
|
|
-import org.elasticsearch.ElasticsearchException;
|
|
|
import org.elasticsearch.ElasticsearchParseException;
|
|
|
import org.elasticsearch.common.geo.ShapeRelation;
|
|
|
import org.elasticsearch.common.lucene.BytesRefs;
|
|
@@ -79,7 +78,6 @@ import java.util.Set;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
import static org.elasticsearch.index.mapper.TypeParsers.parseField;
|
|
|
-import static org.elasticsearch.search.SearchService.ALLOW_EXPENSIVE_QUERIES;
|
|
|
|
|
|
/**
|
|
|
* A {@link FieldMapper} for indexing fields with ngrams for efficient wildcard matching
|
|
@@ -299,12 +297,6 @@ public class WildcardFieldMapper extends FieldMapper {
|
|
|
return new MatchNoDocsQuery();
|
|
|
}
|
|
|
|
|
|
- if (context.allowExpensiveQueries() == false) {
|
|
|
- throw new ElasticsearchException(
|
|
|
- "[regexp] queries cannot be executed when '" + ALLOW_EXPENSIVE_QUERIES.getKey() + "' is set to false."
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
RegExp ngramRegex = new RegExp(addLineEndChars(toLowerCase(value)), flags);
|
|
|
|
|
|
Query approxBooleanQuery = toApproximationQuery(ngramRegex);
|
|
@@ -670,10 +662,6 @@ public class WildcardFieldMapper extends FieldMapper {
|
|
|
DateMathParser parser,
|
|
|
QueryShardContext context
|
|
|
) {
|
|
|
- if (context.allowExpensiveQueries() == false) {
|
|
|
- throw new ElasticsearchException("[range] queries on [wildcard] fields cannot be executed when '" +
|
|
|
- ALLOW_EXPENSIVE_QUERIES.getKey() + "' is set to false.");
|
|
|
- }
|
|
|
BytesRef lower = lowerTerm == null ? null : BytesRefs.toBytesRef(lowerTerm);
|
|
|
BytesRef upper = upperTerm == null ? null : BytesRefs.toBytesRef(upperTerm);
|
|
|
Query accelerationQuery = null;
|