无法使用RestClient Java API在ElasticSearch中保存String []数据

时间:2019-04-01 12:25:30

标签: elasticsearch rest-client elasticsearch-java-api

我正在尝试将String []数据保存在ElasticSearch中。我正在使用RestClient Java API进行操作。 使用下面的代码段

try(RestHighLevelClient client = ElasticSearchClient.client()) { Gson gson = new Gson(); IndexRequest request = new IndexRequest(index.toLowerCase(), type); request.source(gson.toJson(str), XContentType.JSON); //for String IndexResponse response = client.index(request, RequestOptions.DEFAULT); Logger.log("Create Response:", response.toString()); } catch (IOException ex) { Logger.log("Exception occurred while Insert document : ", ex.toString()); }

我收到URI [/ study / _doc?timeout = 1m],状态行[HTTP / 1.1 400 Bad Request]作为错误消息。

我该怎么做?请帮助。

0 个答案:

没有答案
相关问题