daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public List<ProfileDocument> searchByTechnology(String technology) throws Exception {
  2.  
  3.         SearchRequest searchRequest = new SearchRequest();
  4.         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
  5.  
  6.         QueryBuilder queryBuilder = QueryBuilders
  7.                 .boolQuery()
  8.                 .must(QueryBuilders
  9.                         .matchQuery("technologies.name", technology));
  10.  
  11.         searchSourceBuilder.query(QueryBuilders
  12.                 .nestedQuery("technologies",
  13.                         queryBuilder,
  14.                         ScoreMode.Avg));
  15.  
  16.         searchRequest.source(searchSourceBuilder);
  17.  
  18.         SearchResponse response =
  19.                 client.search(searchRequest, RequestOptions.DEFAULT);
  20.  
  21.         return getSearchResult(response);
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top