Java Code Examples for org.elasticsearch.index.query.TermQueryBuilder
The following examples show how to use
org.elasticsearch.index.query.TermQueryBuilder.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: code Author: lastwhispers File: Select.java License: Apache License 2.0 | 6 votes |
/** * 布尔与词条查询 * 语法: * QueryBuilders:查询构建器工厂 * BoolQueryBuilder:布尔查询构建器 * TermQueryBuilder:词条查询构建器 * 示例: * 查询名称包含手机的,并且品牌为小米的记录 */ @Test public void test2() throws IOException { //2.封装查询请求 SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); // 布尔查询构建器 BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); MatchQueryBuilder matchQueryBuilder = QueryBuilders.matchQuery("name", "手机"); // 词条查询构建器 TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("brandName", "小米"); boolQueryBuilder.must(matchQueryBuilder); boolQueryBuilder.must(termQueryBuilder); searchSourceBuilder.query(boolQueryBuilder); searchRequest.source(searchSourceBuilder); }
Example #2
Source Project: elastic-crud Author: jloisel File: RepositoryIntegrationTest.java License: Apache License 2.0 | 5 votes |
@Test public void shouldFindByFirstnameAndLastname() { final Person saved = repository.save(PERSON); final TermQueryBuilder byFirstname = new TermQueryBuilder("firstname", PERSON.getFirstname()); final TermQueryBuilder byLastname = new TermQueryBuilder("lastname", PERSON.getLastname()); final BoolQueryBuilder bool = new BoolQueryBuilder() .must(byFirstname) .must(byLastname); final List<Person> search = repository.search(bool); assertEquals(1, search.size()); assertEquals(saved, search.get(0)); repository.delete(saved); }
Example #3
Source Project: elasticsearch-learning-to-rank Author: o19s File: ExplorerQueryBuilderTests.java License: Apache License 2.0 | 5 votes |
@Override protected ExplorerQueryBuilder doCreateTestQueryBuilder() { ExplorerQueryBuilder builder = new ExplorerQueryBuilder(); builder.query(new TermQueryBuilder("foo", "bar")); builder.statsType("sum_raw_ttf"); return builder; }
Example #4
Source Project: fess Author: codelibs File: BsBoostDocumentRuleCQ.java License: Apache License 2.0 | 4 votes |
public void setBoostExpr_Equal(String boostExpr, ConditionOptionCall<TermQueryBuilder> opLambda) { setBoostExpr_Term(boostExpr, opLambda); }
Example #5
Source Project: fess Author: codelibs File: BsBoostDocumentRuleCQ.java License: Apache License 2.0 | 4 votes |
public void setId_Equal(String id, ConditionOptionCall<TermQueryBuilder> opLambda) { setId_Term(id, opLambda); }
Example #6
Source Project: fess Author: codelibs File: BsCrawlingInfoCQ.java License: Apache License 2.0 | 4 votes |
public void setExpiredTime_Equal(Long expiredTime, ConditionOptionCall<TermQueryBuilder> opLambda) { setExpiredTime_Term(expiredTime, opLambda); }
Example #7
Source Project: fess Author: codelibs File: BsRelatedQueryCQ.java License: Apache License 2.0 | 4 votes |
public void setUpdatedTime_Equal(Long updatedTime, ConditionOptionCall<TermQueryBuilder> opLambda) { setUpdatedTime_Term(updatedTime, opLambda); }
Example #8
Source Project: fess Author: codelibs File: BsCrawlingInfoParamCQ.java License: Apache License 2.0 | 4 votes |
public void setCreatedTime_Equal(Long createdTime, ConditionOptionCall<TermQueryBuilder> opLambda) { setCreatedTime_Term(createdTime, opLambda); }
Example #9
Source Project: fess Author: codelibs File: BsRoleTypeCQ.java License: Apache License 2.0 | 4 votes |
public void setUpdatedTime_Term(Long updatedTime, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("updatedTime", updatedTime); if (opLambda != null) { opLambda.callback(builder); } }
Example #10
Source Project: fess Author: codelibs File: BsFailureUrlCQ.java License: Apache License 2.0 | 4 votes |
public void setErrorCount_Equal(Integer errorCount, ConditionOptionCall<TermQueryBuilder> opLambda) { setErrorCount_Term(errorCount, opLambda); }
Example #11
Source Project: fess Author: codelibs File: BsRelatedContentCQ.java License: Apache License 2.0 | 4 votes |
public void setCreatedBy_Term(String createdBy, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("createdBy", createdBy); if (opLambda != null) { opLambda.callback(builder); } }
Example #12
Source Project: fess Author: codelibs File: BsWebConfigCQ.java License: Apache License 2.0 | 4 votes |
public void setPermissions_Term(String permissions, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("permissions", permissions); if (opLambda != null) { opLambda.callback(builder); } }
Example #13
Source Project: fess Author: codelibs File: BsFileAuthenticationCQ.java License: Apache License 2.0 | 4 votes |
public void setParameters_Equal(String parameters, ConditionOptionCall<TermQueryBuilder> opLambda) { setParameters_Term(parameters, opLambda); }
Example #14
Source Project: fess Author: codelibs File: BsLabelTypeCQ.java License: Apache License 2.0 | 4 votes |
public void setValue_Equal(String value, ConditionOptionCall<TermQueryBuilder> opLambda) { setValue_Term(value, opLambda); }
Example #15
Source Project: fess Author: codelibs File: BsRelatedContentCQ.java License: Apache License 2.0 | 4 votes |
public void setContent_Term(String content, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("content", content); if (opLambda != null) { opLambda.callback(builder); } }
Example #16
Source Project: fess Author: codelibs File: BsFileConfigCQ.java License: Apache License 2.0 | 4 votes |
public void setSortOrder_Term(Integer sortOrder, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("sortOrder", sortOrder); if (opLambda != null) { opLambda.callback(builder); } }
Example #17
Source Project: fess Author: codelibs File: BsUserInfoCQ.java License: Apache License 2.0 | 4 votes |
public void setUpdatedAt_Equal(LocalDateTime updatedAt, ConditionOptionCall<TermQueryBuilder> opLambda) { setUpdatedAt_Term(updatedAt, opLambda); }
Example #18
Source Project: fess Author: codelibs File: BsRoleCQ.java License: Apache License 2.0 | 4 votes |
public void setName_Equal(String name, ConditionOptionCall<TermQueryBuilder> opLambda) { setName_Term(name, opLambda); }
Example #19
Source Project: fess Author: codelibs File: BsCrawlingInfoCQ.java License: Apache License 2.0 | 4 votes |
public void setName_Term(String name, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("name", name); if (opLambda != null) { opLambda.callback(builder); } }
Example #20
Source Project: fess Author: codelibs File: BsWebAuthenticationCQ.java License: Apache License 2.0 | 4 votes |
public void setWebConfigId_Equal(String webConfigId, ConditionOptionCall<TermQueryBuilder> opLambda) { setWebConfigId_Term(webConfigId, opLambda); }
Example #21
Source Project: fess Author: codelibs File: BsPathMappingCQ.java License: Apache License 2.0 | 4 votes |
public void setUserAgent_Term(String userAgent, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("userAgent", userAgent); if (opLambda != null) { opLambda.callback(builder); } }
Example #22
Source Project: fess Author: codelibs File: BsElevateWordCQ.java License: Apache License 2.0 | 4 votes |
public void setCreatedBy_Equal(String createdBy, ConditionOptionCall<TermQueryBuilder> opLambda) { setCreatedBy_Term(createdBy, opLambda); }
Example #23
Source Project: fess Author: codelibs File: BsWebConfigCQ.java License: Apache License 2.0 | 4 votes |
public void setDepth_Equal(Integer depth, ConditionOptionCall<TermQueryBuilder> opLambda) { setDepth_Term(depth, opLambda); }
Example #24
Source Project: fess Author: codelibs File: BsBadWordCQ.java License: Apache License 2.0 | 4 votes |
public void setUpdatedTime_Equal(Long updatedTime, ConditionOptionCall<TermQueryBuilder> opLambda) { setUpdatedTime_Term(updatedTime, opLambda); }
Example #25
Source Project: fess Author: codelibs File: BsRelatedContentCQ.java License: Apache License 2.0 | 4 votes |
public void setUpdatedBy_Term(String updatedBy, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("updatedBy", updatedBy); if (opLambda != null) { opLambda.callback(builder); } }
Example #26
Source Project: fess Author: codelibs File: BsBoostDocumentRuleCQ.java License: Apache License 2.0 | 4 votes |
public void setId_Term(String id, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("_id", id); if (opLambda != null) { opLambda.callback(builder); } }
Example #27
Source Project: fess Author: codelibs File: BsUserInfoCQ.java License: Apache License 2.0 | 4 votes |
public void setId_Term(String id, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("_id", id); if (opLambda != null) { opLambda.callback(builder); } }
Example #28
Source Project: fess Author: codelibs File: BsRelatedContentCQ.java License: Apache License 2.0 | 4 votes |
public void setSortOrder_Equal(Integer sortOrder, ConditionOptionCall<TermQueryBuilder> opLambda) { setSortOrder_Term(sortOrder, opLambda); }
Example #29
Source Project: fess Author: codelibs File: BsRelatedContentCQ.java License: Apache License 2.0 | 4 votes |
public void setId_Term(String id, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("_id", id); if (opLambda != null) { opLambda.callback(builder); } }
Example #30
Source Project: fess Author: codelibs File: BsFileConfigCQ.java License: Apache License 2.0 | 4 votes |
public void setAvailable_Term(Boolean available, ConditionOptionCall<TermQueryBuilder> opLambda) { TermQueryBuilder builder = regTermQ("available", available); if (opLambda != null) { opLambda.callback(builder); } }