SHARE
TWEET

Untitled

a guest Oct 4th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.  "type": "jdbc",
  3.  "jdbc": {
  4.     "url": "jdbc:mysql://localhost:3306/mydb",
  5.     "user": "root",
  6.     "password": "root",
  7.     "sql": "a very big sql query;",
  8.     "index": "my_index",
  9.     "type": "providersForu"
  10.   },
  11.   "strategy" : "simple",
  12.   "autocommit": true,
  13.   "schedule":"0 0/1 * 1/1 * ? *",
  14.   "ttl": {
  15.      "enabled": true, "default":"5m"
  16.   }
  17. }
  18.    
  19. private SearchHit[] getSearchHitPhrase(String types, int indice) {
  20.     //Search Request Builder
  21.  
  22.     QueryBuilder queryBuilder = QueryBuilders.matchAllQuery();
  23.     queryBuilder = QueryBuilders.matchPhrasePrefixQuery(Constants.ES_FIELD_FILTRE, mot).slop(100).analyzer("stopwords_analyzer");
  24.     SearchRequestBuilder searchRequest = client.prepareSearch()
  25.             .setTypes(types)
  26.             .setVersion(true)
  27.             .setSize(Constants.PAGINATION_SIZE)
  28.             .setFrom(indice)
  29.             .setQuery(queryBuilder)
  30.             .setExplain(true)
  31.             .setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
  32.  
  33.     // Executer la requete
  34.     SearchResponse searchResponse = searchRequest.execute().actionGet();
  35.     // Extrait les resultats
  36.     return searchResponse.getHits().getHits();
  37. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top