How to talk to aws elasticsearch service using elastic java client?

前端 未结 3 641
逝去的感伤
逝去的感伤 2020-12-15 08:31

I have set up a elasticsearch server using AWS elasticsearch service (Not EC2). It gave me an endpoint https://xxx-xxxxxxxx.us-west-2.es.amazonaws.com/ and if I click this e

3条回答
  •  失恋的感觉
    2020-12-15 09:22

    After lot of search i found an example which used a GET request, so I made minor changes to it for allowing POST requests so that complex queries can be submitted via POST body. The implementation is available at https://github.com/dy10/aws-elasticsearch-query-java

    Apart from properly configuring access to you AWS ES (i.e. dont open it to Public), make sure to use https (the above code uses http; just replace http with https in the code and it will work).

    Another useful looking but partial implementation is at https://github.com/aws/aws-sdk-java/issues/861

提交回复
热议问题