我发布以下数据以使用批量API进行更新。
{"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkW","_retry_on_conflict":3}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZka","_retry_on_conflict":3}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkf","_retry_on_conflict":3}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
但在发布Iam后收到以下错误
{
"error": "ElasticsearchIllegalArgumentException[No feature for name [_bulk]]",
"status": 400
}
这可能是什么原因?
答案 0 :(得分:1)
如果您想使用批量处理请求更新文档,则需要首先指定update
操作:
{"update" : { "_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkW","_retry_on_conflict":3} }
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"update" : {"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZka","_retry_on_conflict":3} }
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"update" : {"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkf","_retry_on_conflict":3} }
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
答案 1 :(得分:0)
您发送数据的格式不正确。您需要指定在使用批量操作时要执行的操作。 由于您尝试更新,因此您的数据格式应如下所示:
{"update":{"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkW","_retry_on_conflict":3}}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"update":{"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZka","_retry_on_conflict":3}}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
{"update": {"_index":"false-matter-alert","_type":"eventlog","_id":"AVJDZBZ-cQ6ZeQVtbZkf","_retry_on_conflict":3}}
{"doc":{"tier":"WEB SERVICE","doc_as_upsert":true}}
有关格式的详细信息,请查看批量API here
的文档