java.lang.NoSuchMethodError: ‘void org.elasticsearch.client.Request.addParameters(java.util.Map)‘
阿新 • • 發佈:2021-01-02
技術標籤:ES
{ "name": "node-1", "cluster_name": "elasticsearch", "cluster_uuid": "OsgO9-IrT0qVnhV76kcQWA", "version": { "number": "7.3.0", "build_flavor": "default", "build_type": "zip", "build_hash": "de777fa", "build_date": "2019-07-24T18:30:11.767338Z", "build_snapshot": false, "lucene_version": "8.1.0", "minimum_wire_compatibility_version": "6.8.0", "minimum_index_compatibility_version": "6.0.0-beta1" }, "tagline": "You Know, for Search" }
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.3.0</version>
</dependency>
<properties> <es.version>7.3.0</es.version> </properties> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>${es.version}</version> <exclusions> <exclusion> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> </exclusion> <exclusion> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${es.version}</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>${es.version}</version> </dependency>
PUT /book/_doc/1 { "name": "Bootstrap開發", "description": "Bootstrap是由Twitter推出的一個前臺頁面開發css框架,是一個非常流行的開發框架,此框架集成了多種頁面效果。此開發框架包含了大量的CSS、JS程式程式碼,可以幫助開發者(尤其是不擅長css頁面開發的程式人員)輕鬆的實現一個css,不受瀏覽器限制的精美介面css效果。", "studymodel": "201002", "price":38.6, "timestamp":"2019-08-25 19:11:35", "pic":"group1/M00/00/00/wKhlQFs6RCeAY0pHAAJx5ZjNDEM428.jpg", "tags": [ "bootstrap", "dev"] }
public class TestDemo {
public static void main(String[] args) throws IOException {
/**
* GET /book/_doc/1
*/
// 1獲取連線客戶端
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
new HttpHost("127.0.0.1", 9200, "http")
));
// 2構建請求
GetRequest getRequest = new GetRequest("book", "1");
// 3執行
GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT);
// 4獲取結果
System.out.println(getResponse.getId());
System.out.println(getResponse.getVersion());
System.out.println(getResponse.getSourceAsString());
}
}
//1
//2
//{"name":"Bootstrap開發","description":"Bootstrap是由Twitter推出的一個前臺頁面開發css框架,是一個非常流行的開發框架,此框架集成了多種頁面效果。此開發框架包含了大量的CSS、JS程式程式碼,可以幫助開發者(尤其是不擅長css頁面開發的程式人員)輕鬆的實現一個css,不受瀏覽器限制的精美介面css效果。","studymodel":"201002","price":38.6,"timestamp":"2019-08-25 19:11:35","pic":"group1/M00/00/00/wKhlQFs6RCeAY0pHAAJx5ZjNDEM428.jpg","tags":["bootstrap","dev"]}