-
-
Save javajack/09956bfdbad8487aaaa39ffb15ca3e12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<ProfileDocument> searchByTechnology(String technology) throws Exception { | |
SearchRequest searchRequest = new SearchRequest(); | |
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); | |
QueryBuilder queryBuilder = QueryBuilders | |
.boolQuery() | |
.must(QueryBuilders | |
.matchQuery("technologies.name", technology)); | |
searchSourceBuilder.query(QueryBuilders | |
.nestedQuery("technologies", | |
queryBuilder, | |
ScoreMode.Avg)); | |
searchRequest.source(searchSourceBuilder); | |
SearchResponse response = | |
client.search(searchRequest, RequestOptions.DEFAULT); | |
return getSearchResult(response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment