Java 类org.elasticsearch.index.query.NestedFilterBuilder 实例源码

项目:atlas-deer    文件:FiltersBuilder.java   
private static void addFilterForTopicId(
        BoolFilterBuilder filterBuilder,
        InclusionExclusionId id
) {
    NestedFilterBuilder filterForId = FilterBuilders.nestedFilter(
            EsContent.TOPICS + "." + EsTopic.TYPE_NAME,
            FilterBuilders.termFilter(
                    EsContent.TOPICS + "." + EsTopic.TYPE_NAME + "." + EsContent.ID,
                    id.getId()
            )
    );
    if (id.isExcluded()) {
        filterBuilder.mustNot(filterForId);
    } else {
        filterBuilder.must(filterForId);
    }
}
项目:atlas-deer    文件:FiltersBuilder.java   
private static FilterBuilder buildAvailabilityFilter() {
    NestedFilterBuilder rangeFilter = FilterBuilders.nestedFilter(
            EsContent.LOCATIONS,
            FilterBuilders.andFilter(
                    FilterBuilders.rangeFilter(EsLocation.AVAILABILITY_TIME)
                            .lte(ElasticsearchUtils.clampDateToFloorMinute(DateTime.now())
                                    .toString()),
                    FilterBuilders.rangeFilter(EsLocation.AVAILABILITY_END_TIME)
                            .gte(ElasticsearchUtils.clampDateToFloorMinute(DateTime.now())
                                    .toString())
            )
    );
    return FilterBuilders.orFilter(
            rangeFilter,
            FilterBuilders.hasChildFilter(EsContent.CHILD_ITEM, rangeFilter)
    );
}
项目:usergrid    文件:EsQueryVistor.java   
/**
 * Generate the field name term for the field name for filters
 */
private NestedFilterBuilder fieldNameTerm( final String fieldName, final FilterBuilder fieldValueBuilder ) {

    final BoolFilterBuilder booleanQuery = FilterBuilders.boolFilter();

    booleanQuery.must( FilterBuilders.termFilter( IndexingUtils.FIELD_NAME_NESTED, fieldName ) );

    booleanQuery.must( fieldValueBuilder );


    return FilterBuilders.nestedFilter( IndexingUtils.ENTITY_FIELDS, booleanQuery );
}