Skip to content

update option "doc_as_upsert" needs text string "true" instead of boolean "True" #440

@ersiko

Description

@ersiko

Hi

Tried using "doc_as_upsert" in my updates. If the body of my request had a boolean value (ie "'doc_as_upsert': True") it didn't create new docs (it updated the existing ones, though). I needed to use 'true' in a text string (ie "'doc_as_upsert' : 'true'"), and then it created new documents.

That means this call doesn't create new documents:

es.update(index="my_index", doc_type="my_doc_type", id=my_id, body={"doc":my_dict_update,'doc_as_upsert':True})

But this call does:

es.update(index="my_index", doc_type="my_doc_type", id=my_id, body={"doc":my_dict_update,'doc_as_upsert':'true'})

Maybe it's not a bug and it should work like that, as elasticsearch is expecting the string and not the boolean (maybe that should change in elasticsearch?). In that case, it would be a good idea to add a note to the documentation (I can try to help with that).

I'm using elasticsearch-py version 2.4 and elasticsearch version 2.3.4.

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions