本文整理汇总了Java中org.elasticsearch.index.query.QueryBuilders.wildcardQuery方法的典型用法代码示例。如果您正苦于以下问题:Java QueryBuilders.wildcardQuery方法的具体用法?Java QueryBuilders.wildcardQuery怎么用?Java QueryBuilders.wildcardQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.index.query.QueryBuilders
的用法示例。
在下文中一共展示了QueryBuilders.wildcardQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
/**
* Here to establish QueryBuilder patterns
*/
void test() {
SearchSourceBuilder b;
BoolQueryBuilder qb = QueryBuilders.boolQuery();
QueryBuilder qbmm = QueryBuilders.multiMatchQuery("name", "fieldNames");
QueryBuilder qbm = QueryBuilders.matchQuery("name", "text");
QueryBuilder qbmp = QueryBuilders.matchPhraseQuery("name", "text");
QueryBuilder qb1 = QueryBuilders.termQuery(ITQCoreOntology.TUPLE_SUBJECT_PROPERTY, "");
QueryBuilder qb2 = QueryBuilders.termQuery(ITQCoreOntology.TUPLE_OBJECT_PROPERTY, "");
QueryBuilder qb3 = QueryBuilders.termQuery(ITQCoreOntology.INSTANCE_OF_PROPERTY_TYPE, "");
qb.must(qb3);
qb.should(qb1);
qb.should(qb2);
QueryBuilder partial = QueryBuilders.regexpQuery("name", "regexp");
QueryBuilder wildcard = QueryBuilders.wildcardQuery("name", "query");
}
示例2: testForClient
import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
@Test
public void testForClient() throws Exception {
QueryBuilder qb = QueryBuilders.wildcardQuery("user", "k?mc*");
client.prepareSearch().setQuery(qb).execute().actionGet();
}
示例3: wildCardTextQuerySingleField
import org.elasticsearch.index.query.QueryBuilders; //导入方法依赖的package包/类
/**
* <p>e.g. "W?F*HW"
* where "?" matches any character
* where * matches zero or more characters</p>
* <p>Note, avoid using terms which begin with a wildcard,
* e.g. *foo</p>
* @param textQuery
* @param fieldName
* @param start
* @param count
* @return
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/_wildcard_and_regexp_queries.html
*/
public String wildCardTextQuerySingleField(String textQuery, String fieldName, int start, int count) {
QueryBuilder qb = QueryBuilders.wildcardQuery(fieldName, textQuery);
SearchSourceBuilder ssb = new SearchSourceBuilder();
ssb.query(qb);
ssb.from(start);
if (count > -1)
ssb.size(count);
return ssb.toString();
}