close
Skip to content

Copy auto generated _id to id when first saving  #6

@rochacbruno

Description

@rochacbruno

Giving a doc that omits id

class Doc(Document):
    name = StringField()

doc = Doc(name="test")
doc.save()

The above document will be saved with {"name": "test", "id": null} in "_source" and generated "_id" only in toplevel hits.

There are 2 options

  1. Copy generated "_id" in to "id"
  2. Not adding "id" field to document _fields and when doc.id is called, serve doc._id

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions