本文整理汇总了Java中org.elasticsearch.index.query.TermFilterBuilder类的典型用法代码示例。如果您正苦于以下问题:Java TermFilterBuilder类的具体用法?Java TermFilterBuilder怎么用?Java TermFilterBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TermFilterBuilder类属于org.elasticsearch.index.query包,在下文中一共展示了TermFilterBuilder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: should_create_alias_with_filter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
@Test
public void should_create_alias_with_filter() throws Exception {
String index = "index_without_alias";
createIndex(index);
ensureGreen(index);
// add a mapping so I can add a filter, else it will fail due to strict resolution of fields
createSimpleDoc(index, THE_TYPE, THE_ID);
ensureSearchable(index);
IndicesAliasesRequest request = new IndicesAliasesRequest();
TermFilterBuilder filter = termFilter("the_string_field", "some_value");
request.addAlias("the_alias", filter, index);
IndicesAliasesResponse response = httpClient.admin().indices().aliases(request).get();
Assertions.assertThat(response.isAcknowledged()).isTrue();
GetAliasesResponse finalState = transportClient.admin().indices().getAliases(new GetAliasesRequest()).actionGet();
Assertions.assertThat(finalState.getAliases().get(index)).hasSize(1);
Assertions.assertThat(finalState.getAliases().get(index).get(0).alias()).isEqualTo("the_alias");
String requestFilter = request.getAliasActions().get(0).aliasAction().filter();
CompressedString actualFilter = finalState.getAliases().get(index).get(0).filter();
Assertions.assertThat(actualFilter.string()).isEqualTo(requestFilter);
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:27,代码来源:IndicesAliasesActionHandlerTest.java
示例2: findByAreaDeInteresse
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
@Cacheable("servicos-por-area-de-interesse")
default List<ServicoXML> findByAreaDeInteresse(AreaDeInteresse areaDeInteresse) {
return search(new NativeSearchQueryBuilder()
.withFilter(new TermFilterBuilder("areasDeInteresse", singletonList(areaDeInteresse)))
.withSort(new FieldSortBuilder("nome").order(ASC))
.build())
.getContent();
}
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:9,代码来源:ServicoRepository.java
示例3: findBySegmentoDaSociedade
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
@Cacheable("servicos-por-segmento-da-sociedade")
default List<ServicoXML> findBySegmentoDaSociedade(SegmentoDaSociedade segmentoDaSociedade) {
return search(new NativeSearchQueryBuilder()
.withFilter(new TermFilterBuilder("segmentosDaSociedade", singletonList(segmentoDaSociedade)))
.withSort(new FieldSortBuilder("nome").order(ASC))
.build())
.getContent();
}
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:9,代码来源:ServicoRepository.java
示例4: rarityOrFilter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
private FilterBuilder rarityOrFilter(List<Rarity> list) {
List<TermFilterBuilder> filters = list.stream()
.map(l -> termFilter("attributes.rarity", l.displayName()))
.collect(Collectors.toList());
TermFilterBuilder[] array = new TermFilterBuilder[filters.size()];
array = filters.toArray(array);
return orFilter(array);
}
开发者ID:thirdy,项目名称:blackmarket,代码行数:9,代码来源:ControlPane.java
示例5: getTermFilter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
private TermFilterBuilder getTermFilter(String fieldName, String fieldValue)
{
return FilterBuilders.termFilter(fieldName, fieldValue);
}
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:5,代码来源:ProductQueryServiceImpl.java
示例6: getTermFilter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
private TermFilterBuilder getTermFilter(final String fieldName, final String fieldValue)
{
return FilterBuilders.termFilter(fieldName, fieldValue);
}
开发者ID:jaibeermalik,项目名称:elasticsearch-akka,代码行数:5,代码来源:ProductQueryServiceImpl.java
示例7: getTermFilter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
private TermFilterBuilder getTermFilter(final String fieldName,
final String fieldValue) {
return FilterBuilders.termFilter(fieldName, fieldValue);
}
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:5,代码来源:ProductQueryServiceImpl.java
示例8: visit
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
@Override
public void visit( Equal op ) throws NoIndexException {
final String name = op.getProperty().getValue().toLowerCase();
final Object value = op.getLiteral().getValue();
//special case so we support our '*' char with wildcard, also should work for uuids
if ( value instanceof String || value instanceof UUID ) {
String stringValue = ((value instanceof String) ? (String)value : value.toString()).toLowerCase().trim();
// or field is just a string that does need a prefix us a query
if ( stringValue.contains( "*" ) ) {
//Because of our legacy behavior, where we match CCCC*, we need to use the unanalyzed string to ensure that
//we start
final WildcardQueryBuilder wildcardQuery =
QueryBuilders.wildcardQuery( IndexingUtils.FIELD_STRING_NESTED_UNANALYZED, stringValue );
queryBuilders.push( fieldNameTerm( name, wildcardQuery ) );
filterBuilders.push( NoOpFilterBuilder.INSTANCE );
return;
}
// Usergrid query parser allows single quotes to be escaped in values
if ( stringValue.contains("\\'")) {
stringValue = stringValue.replace("\\'", "'");
}
//it's an exact match, use a filter
final TermFilterBuilder termFilter =
FilterBuilders.termFilter( IndexingUtils.FIELD_STRING_NESTED_UNANALYZED, stringValue );
queryBuilders.push( NoOpQueryBuilder.INSTANCE );
filterBuilders.push( fieldNameTerm( name, termFilter ) );
return;
}
// assume all other types need prefix
final TermFilterBuilder termQuery =
FilterBuilders.termFilter(getFieldNameForType(value), sanitize(value));
filterBuilders.push( fieldNameTerm( name, termQuery ) );
queryBuilders.push( NoOpQueryBuilder.INSTANCE );
}
开发者ID:apache,项目名称:usergrid,代码行数:46,代码来源:EsQueryVistor.java
示例9: sortPropertyTermFilter
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
/**
* Create a term filter for our sorts
*/
public static TermFilterBuilder sortPropertyTermFilter( final String propertyName ) {
return FilterBuilders.termFilter( IndexingUtils.FIELD_NAME, propertyName );
}
开发者ID:apache,项目名称:usergrid,代码行数:7,代码来源:SortBuilder.java
示例10: createSort
import org.elasticsearch.index.query.TermFilterBuilder; //导入依赖的package包/类
/**
* Create a sort for the property name and field name specified
*
* @param sortOrder The sort order
* @param fieldName The name of the field for the type
* @param propertyName The property name the user specified for the sort
*/
private FieldSortBuilder createSort( final SortOrder sortOrder, final String fieldName,
final String propertyName ) {
final TermFilterBuilder propertyFilter = sortPropertyTermFilter( propertyName );
return SortBuilders.fieldSort( fieldName ).order( sortOrder ).setNestedFilter( propertyFilter );
}
开发者ID:apache,项目名称:usergrid,代码行数:16,代码来源:SearchRequestBuilderStrategy.java
注:本文中的org.elasticsearch.index.query.TermFilterBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论