Keine Fehler in einer Aktion beeinflussen die anderen nicht.
Vom documentation von Elasticsearch bulk api:
Die Antwort auf eine Bulk-Aktion ist eine große JSON-Struktur mit den einzelnen Ergebnisse jeder Aktion, die durchgeführt wurde. Der Ausfall einer einzelnen Aktion wirkt sich nicht auf die verbleibenden Aktionen aus.
In der Antwort von Elasticsearch Client gibt es status
in Reaktion auf jede Aktion entspricht, um zu bestimmen, ob es ein Fehler war oder nicht
Beispiel:
client.bulk({
body: [
// action description
{ index: { _index: 'test', _type: 'test', _id: 1 } },
// the document to index
{ title: 'foo' },
// action description
{ update: { _index: 'test', _type: 'test', _id: 332 } },
// the document to update
{ doc: { title: 'foo' } },
// action description
{ delete: { _index: 'test', _type: 'test', _id: 33 } },
// no document needed for this delete
]
}, function (err, resp) {
if(resp.errors) {
console.log(JSON.stringify(resp, null, '\t'));
}
});
Reaktion:
{
"took": 13,
"errors": true,
"items": [
{
"index": {
"_index": "test",
"_type": "test",
"_id": "1",
"_version": 20,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"status": 200
}
},
{
"update": {
"_index": "test",
"_type": "test",
"_id": "332",
"status": 404,
"error": {
"type": "document_missing_exception",
"reason": "[test][332]: document missing",
"shard": "-1",
"index": "test"
}
}
},
{
"delete": {
"_index": "test",
"_type": "test",
"_id": "33",
"_version": 2,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"status": 404,
"found": false
}
}
]
}
wenn resp.errors === true - kann ich darauf zählen, dass Artikel in der gleichen Reihenfolge bestellt werden, in der ich sie gesendet habe die Massenanfrage? –
Ja, es wäre in der gleichen Reihenfolge – keety