【问题标题】:Is it possible to insert data in to Elastic Search from URL?是否可以从 URL 将数据插入到 Elastic Search 中?
【发布时间】:2017-08-30 13:23:23
【问题描述】:

目前,我正在处理ElasticSearch,我能够使用 CMD 将数据插入 ElasticSearch 有没有一种方法可以使用 java 将 JSON 数据从 Web URL 插入到 ElasticSerach。

【问题讨论】:

    标签: java json elasticsearch elasticsearch-indices


    【解决方案1】:

    是的,您可以使用 rest 客户端。以下是代码 -

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

    否则,您可以使用常规传输客户端

    TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
            .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostName), portNumber));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 1970-01-01
      • 2021-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多