.map(this::indexedValueForSearch) .anyMatch(indexType::equals)) { if (context.getMapperService().hasNested()) {
final boolean hasNested = indexShard.mapperService().hasNested(); final boolean isSplit = sourceMetaData.getNumberOfShards() < indexShard.indexSettings().getNumberOfShards(); assert isSplit == false || sourceMetaData.getCreationVersion().onOrAfter(Version.V_6_0_0_alpha1) : "for split we require a " +
@Override public Query buildFilteredQuery(Query query) { List<Query> filters = new ArrayList<>(); Query typeFilter = createTypeFilter(queryShardContext.getTypes()); if (typeFilter != null) { filters.add(typeFilter); } if (mapperService().hasNested() && typeFilter == null // when a _type filter is set, it will automatically exclude nested docs && new NestedHelper(mapperService()).mightMatchNestedDocs(query) && (aliasFilter == null || new NestedHelper(mapperService()).mightMatchNestedDocs(aliasFilter))) { filters.add(Queries.newNonNestedFilter(mapperService().getIndexSettings().getIndexVersionCreated())); } if (aliasFilter != null) { filters.add(aliasFilter); } if (sliceBuilder != null) { filters.add(sliceBuilder.toFilter(clusterService, request, queryShardContext, minNodeVersion)); } if (filters.isEmpty()) { return query; } else { BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.add(query, Occur.MUST); for (Query filter : filters) { builder.add(filter, Occur.FILTER); } return builder.build(); } }
private int findRootDocumentIfNested(SearchContext context, LeafReaderContext subReaderContext, int subDocId) throws IOException { if (context.mapperService().hasNested()) { BitSet bits = context.bitsetFilterCache() .getBitSetProducer(Queries.newNonNestedFilter(context.indexShard().indexSettings().getIndexVersionCreated())) .getBitSet(subReaderContext); if (!bits.get(subDocId)) { return bits.nextSetBit(subDocId); } } return -1; }
.map(this::indexedValueForSearch) .anyMatch(indexType::equals)) { if (context.getMapperService().hasNested()) {
.map(this::indexedValueForSearch) .anyMatch(indexType::equals)) { if (context.getMapperService().hasNested()) {
.map(this::indexedValueForSearch) .anyMatch(indexType::equals)) { if (context.getMapperService().hasNested()) {
when(mapperService.hasNested()).thenReturn(false); when(mapperService.types()).thenReturn(Collections.singleton(TYPE_NAME)); when(searchContext.mapperService()).thenReturn(mapperService);
final boolean hasNested = indexShard.mapperService().hasNested(); final boolean isSplit = sourceMetaData.getNumberOfShards() < indexShard.indexSettings().getNumberOfShards(); assert isSplit == false || sourceMetaData.getCreationVersion().onOrAfter(Version.V_6_0_0_alpha1) : "for split we require a " +
private int findRootDocumentIfNested(SearchContext context, LeafReaderContext subReaderContext, int subDocId) throws IOException { if (context.mapperService().hasNested()) { BitSet bits = context.bitsetFilterCache().getBitSetProducer(Queries.newNonNestedFilter()).getBitSet(subReaderContext); if (!bits.get(subDocId)) { return bits.nextSetBit(subDocId); } } return -1; }
final boolean hasNested = indexShard.mapperService().hasNested(); final boolean isSplit = sourceMetaData.getNumberOfShards() < indexShard.indexSettings().getNumberOfShards(); assert isSplit == false || sourceMetaData.getCreationVersion().onOrAfter(Version.V_6_0_0_alpha1) : "for split we require a " +
private int findRootDocumentIfNested(SearchContext context, LeafReaderContext subReaderContext, int subDocId) throws IOException { if (context.mapperService().hasNested()) { BitSet bits = context.bitsetFilterCache().getBitSetProducer(Queries.newNonNestedFilter()).getBitSet(subReaderContext); if (!bits.get(subDocId)) { return bits.nextSetBit(subDocId); } } return -1; }
@Override public Query buildFilteredQuery(Query query) { List<Query> filters = new ArrayList<>(); Query typeFilter = createTypeFilter(queryShardContext.getTypes()); if (typeFilter != null) { filters.add(typeFilter); } if (mapperService().hasNested() && typeFilter == null // when a _type filter is set, it will automatically exclude nested docs && new NestedHelper(mapperService()).mightMatchNestedDocs(query) && (aliasFilter == null || new NestedHelper(mapperService()).mightMatchNestedDocs(aliasFilter))) { filters.add(Queries.newNonNestedFilter(mapperService().getIndexSettings().getIndexVersionCreated())); } if (aliasFilter != null) { filters.add(aliasFilter); } if (sliceBuilder != null) { filters.add(sliceBuilder.toFilter(clusterService, request, queryShardContext, minNodeVersion)); } if (filters.isEmpty()) { return query; } else { BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.add(query, Occur.MUST); for (Query filter : filters) { builder.add(filter, Occur.FILTER); } return builder.build(); } }
@Override public Query buildFilteredQuery(Query query) { List<Query> filters = new ArrayList<>(); Query typeFilter = createTypeFilter(queryShardContext.getTypes()); if (typeFilter != null) { filters.add(typeFilter); } if (mapperService().hasNested() && typeFilter == null // when a _type filter is set, it will automatically exclude nested docs && new NestedHelper(mapperService()).mightMatchNestedDocs(query) && (aliasFilter == null || new NestedHelper(mapperService()).mightMatchNestedDocs(aliasFilter))) { filters.add(Queries.newNonNestedFilter(mapperService().getIndexSettings().getIndexVersionCreated())); } if (aliasFilter != null) { filters.add(aliasFilter); } if (sliceBuilder != null) { filters.add(sliceBuilder.toFilter(clusterService, request, queryShardContext, minNodeVersion)); } if (filters.isEmpty()) { return query; } else { BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.add(query, Occur.MUST); for (Query filter : filters) { builder.add(filter, Occur.FILTER); } return builder.build(); } }
private int findRootDocumentIfNested(SearchContext context, LeafReaderContext subReaderContext, int subDocId) throws IOException { if (context.mapperService().hasNested()) { BitSet bits = context.bitsetFilterCache() .getBitSetProducer(Queries.newNonNestedFilter(context.indexShard().indexSettings().getIndexVersionCreated())) .getBitSet(subReaderContext); if (!bits.get(subDocId)) { return bits.nextSetBit(subDocId); } } return -1; }
private int findRootDocumentIfNested(SearchContext context, LeafReaderContext subReaderContext, int subDocId) throws IOException { if (context.mapperService().hasNested()) { BitSet bits = context.bitsetFilterCache() .getBitSetProducer(Queries.newNonNestedFilter(context.indexShard().indexSettings().getIndexVersionCreated())) .getBitSet(subReaderContext); if (!bits.get(subDocId)) { return bits.nextSetBit(subDocId); } } return -1; }
if (mapperService().hasNested()
BitSetProducer parentFilter = mapperService.hasNested() ? indexCache.bitsetFilterCache().getBitSetProducer(Queries.newNonNestedFilter()) : null; return new Engine.DeleteByQuery(query, source, filteringAliases, aliasFilter, parentFilter, origin, startTime, types);