0

Currently, Im working on ElasticSearch and I was able to insert data into ElasticSearch using CMD is there a way that I can insert the JSON data from web URL to ELasticSerach Using java.

Abhishek Ekaanth
  • 2,511
  • 2
  • 19
  • 40

1 Answers1

1

Yes, you can use rest client. Following is the code -

RestClient restClient = RestClient.builder(
       new HttpHost(hostname, portnumber, "http")).build();

Otherwise, you can use regular transport client

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostName), portNumber));
Nikhil Bhide
  • 728
  • 8
  • 23