Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating documents with an existing ID isn't possible #10

Closed
Radiergummi opened this issue Mar 10, 2021 · 0 comments
Closed

Creating documents with an existing ID isn't possible #10

Radiergummi opened this issue Mar 10, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Radiergummi
Copy link
Member

Creating documents and setting their ID (eg. $doc->setAttribute('_id', 'foo')) is rejected as the ID is erroneously set on the request body in addition to the metadata field. This fails with the following error:

{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "failed to parse field [_id] of type [_id] in document with id 'foo'. Preview of field's value: 'foo'",
      "caused_by": {
         "type": "mapper_parsing_exception",
         "reason": "Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
      }
   },
   "status": 400
}

We should ensure to remove any metadata attributes from the request body here.

@Radiergummi Radiergummi added the bug Something isn't working label Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant