Home > database >  RestHighLevelClient7 elasticsearch5 operation type, how to set?
RestHighLevelClient7 elasticsearch5 operation type, how to set?

Time:01-25

Project is used in the client RestHighLevelClient7, double data source configuration operation elasticsearch5 respectively, elasticsearch7, the biggest difference between the two versions is type parameters;
Elasticsearch5 under a index can have multiple type, and elasticsearch7 cannot set type, the default _doc;
In the use of GetRequest rquest=new GetRequest (index, the type, id) query a single document without problems
The method GetResponse response=RHLC. Get (rquest, RequestOptions. DEFAULT)
Returns the correct results


In setting type can have a problem when using the query SearchReques
The SearchRequest SearchRequest=new SearchRequest ();
The searchRequest. Indices (" index ");
The searchRequest. Types (" type ");//the method has been out of date, but I don't know how to set up the type
searchRequest.source(sourceBuilder);

The SearchResponse response=restHighLevelClient. Search (searchRequest, RequestOptions. DEFAULT);

The exception thrown
{" error ": {" root_cause" : [{" type ":" illegal_argument_exception ", "" reason" : "request/index/type/_search contains unrecognized parameters: [ccs_minimize_roundtrips], [ignore_throttled]"}], "type" : "illegal_argument_exception", "" reason" : "request/index/type/_search contains unrecognized parameters: [ccs_minimize_roundtrips], [ignore_throttled]"}, "status" : 400}
  • Related