Merge pull request #13087 from martijnvg/nested/child_filter_can_just_be_regular_filter
Nested query should only use bitset cache for parent filter
This commit is contained in:
commit
9f3043fc78
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.query.support;
|
package org.elasticsearch.index.query.support;
|
||||||
|
|
||||||
|
import org.apache.lucene.search.Filter;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.join.BitDocIdSetFilter;
|
import org.apache.lucene.search.join.BitDocIdSetFilter;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
@ -26,7 +27,6 @@ import org.elasticsearch.common.lucene.search.Queries;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
|
||||||
import org.elasticsearch.index.mapper.object.ObjectMapper;
|
import org.elasticsearch.index.mapper.object.ObjectMapper;
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
import org.elasticsearch.index.query.QueryParseContext;
|
||||||
import org.elasticsearch.index.query.QueryParsingException;
|
import org.elasticsearch.index.query.QueryParsingException;
|
||||||
|
@ -54,7 +54,7 @@ public class NestedInnerQueryParseSupport {
|
||||||
protected boolean filterFound = false;
|
protected boolean filterFound = false;
|
||||||
|
|
||||||
protected BitDocIdSetFilter parentFilter;
|
protected BitDocIdSetFilter parentFilter;
|
||||||
protected BitDocIdSetFilter childFilter;
|
protected Filter childFilter;
|
||||||
|
|
||||||
protected ObjectMapper nestedObjectMapper;
|
protected ObjectMapper nestedObjectMapper;
|
||||||
private ObjectMapper parentObjectMapper;
|
private ObjectMapper parentObjectMapper;
|
||||||
|
@ -191,7 +191,7 @@ public class NestedInnerQueryParseSupport {
|
||||||
} else {
|
} else {
|
||||||
parentFilter = parseContext.bitsetFilter(objectMapper.nestedTypeFilter());
|
parentFilter = parseContext.bitsetFilter(objectMapper.nestedTypeFilter());
|
||||||
}
|
}
|
||||||
childFilter = parseContext.bitsetFilter(nestedObjectMapper.nestedTypeFilter());
|
childFilter = nestedObjectMapper.nestedTypeFilter();
|
||||||
parentObjectMapper = parseContext.nestedScope().nextLevel(nestedObjectMapper);
|
parentObjectMapper = parseContext.nestedScope().nextLevel(nestedObjectMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2452,7 +2452,7 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
|
||||||
Query parsedQuery = queryParser.parse(query).query();
|
Query parsedQuery = queryParser.parse(query).query();
|
||||||
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
|
||||||
assertThat(((ConstantScoreQuery) parsedQuery).getQuery(), instanceOf(ToParentBlockJoinQuery.class));
|
assertThat(((ConstantScoreQuery) parsedQuery).getQuery(), instanceOf(ToParentBlockJoinQuery.class));
|
||||||
assertThat(((ConstantScoreQuery) parsedQuery).getQuery().toString(), equalTo("ToParentBlockJoinQuery (+*:* #random_access(QueryWrapperFilter(_type:__nested)))"));
|
assertThat(((ConstantScoreQuery) parsedQuery).getQuery().toString(), equalTo("ToParentBlockJoinQuery (+*:* #QueryWrapperFilter(_type:__nested))"));
|
||||||
SearchContext.removeCurrent();
|
SearchContext.removeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue