Bulk query not working correctly


#1

Long parameter id strings lead to errors:

POST _bulk
{"create": {"_type": "classified_patentsubset", "_parent": "32273201735", "_index": "patclassifier", "_id": "368_1h"}}
{"doc": {"date_provided": "11.09.2017", "owner": "Eva van der Bey", "class": 0}}
{"create": {"_type": "classified_patentsubset", "_parent": "32216201735", "_index": "patclassifier", "_id": "368_1h"}}
{"doc": {"date_provided": "11.09.2017", "owner": "Eva van der Bey", "class": 0}}

Leads to the following output:
{
"took": 41,
"errors": true,
"items": [
{
"create": {
"_index": "patclassifier",
"_type": "classified_patentsubset",
"_id": "368_1h",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
},
{
"create": {
"_index": "patclassifier",
"_type": "classified_patentsubset",
"_id": "368_1h",
"status": 409,
"error": {
"type": "version_conflict_engine_exception",
"reason": "[classified_patentsubset][368_1h]: version conflict, document already exists (current version [1])",
"index_uuid": "Uljra9TmRm-qdwwg6zqa0Q",
"shard": "0",
"index": "patclassifier"
}
}
}
]
}

While shortening the parent ids, works without problems:

POST _bulk
{"create": {"_type": "classified_patentsubset", "_parent": "32273", "_index": "patclassifier", "_id": "368_1j"}}
{"doc": {"date_provided": "11.09.2017", "owner": "Eva van der Bey", "class": 0}}
{"create": {"_type": "classified_patentsubset", "_parent": "32216", "_index": "patclassifier", "_id": "368_1j"}}
{"doc": {"date_provided": "11.09.2017", "owner": "Eva van der Bey", "class": 0}}

Output is:

{
"took": 5,
"errors": false,
"items": [
{
"create": {
"_index": "patclassifier",
"_type": "classified_patentsubset",
"_id": "368_1j",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
},
{
"create": {
"_index": "patclassifier",
"_type": "classified_patentsubset",
"_id": "368_1j",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
}
]
}


(Christian Dahlqvist) #2

The issue is that you have specified the bulk operation as create, which will fail if the document already exists. As you are routing on the parent document id, it looks like the first example resulted in both parent ids resulting in the same shard, which caused a conflict. In the second example this was likely not the case.

Apart from this it looks like you are trying to use parent-child mapping with more than one parent, which is not supported.


#3

Thanks,

I was not aware that a child can not have many parents.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.