I'm using elasticsearch to save data coming from twitter.
At this point I'm having difficulty deleting data from index and using the Scroll API because after reading about ways to do that, everyone uses the Client and I'm using RestClient.
What I am using:
RestClient restClient = RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")).build();
How do I get the client using RestClient?
Will I have to create Java High Level REST Client?
Using the Transport Client it would be possible to do what I am looking for, but as it will be discontinued / deprecated, I used RestClient .Is it possible to use both?
Thanks and regards
You can use the low-level REST client, but then you need to take care of marshalling the request body and unmarshalling the response body:
Response response = restClient.performRequest("DELETE", "/your-index");
HttpEntity entity = response.getEntity();
//read the response body from the entity
or you can use the high-level REST client, but keep in mind that as of today only the version that works against 6.0.0-beta1 was released. A version that works against 5.6 will be released in the coming weeks. If you are using a previous version of Elasticsearch, you cannot use the high-level REST client:
You are welcome. There isn't a date, but we are targeting version 7.0 for the removal and 6.0 GA for the deprecation most likely. There won't be any additions to it once it's deprecated.
Already, I would like to ask an issue, how can I in Java, check if a particular document already exists in elasticSearch? I have access to the index, type.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.