Hello,
I'm using ElasticSearch 7.10 and trying to index a very sample document following the documentation from here - https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-document-index.html
build.gradle has this:-
compile 'org.elasticsearch:elasticsearch:7.10.1'
compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.10.1'
And I have a main method I'm initializing rest client like this:-
RestClient client = RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")).build();
And this is my request I'm trying to make (I just copy pasted from the docs, didn't change anything)
IndexRequest request = new IndexRequest("posts");
request.id("1");
String jsonString = "{" +
"\"user\":\"kimchy\"," +
"\"postDate\":\"2013-01-30\"," +
"\"message\":\"Elasticsearch\"" +
"}";
request.source(jsonString, XContentType.JSON);
IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT);
But it says Cannot resolve method 'index' in 'RestClient'. Even when using BulkRequest, GetRequest either sync or async also it throws the same error. I have used ElasticSearch java client with 7.0 version few months ago and didn't face any issues. But now, the 7.10 java client documentation is very misleading and not helping much.