Skip to content

Bulk API not working #73

@flashgorman-chorus

Description

@flashgorman-chorus

I am attempting to bulk create a few documents by passing this to bulk:

{"create": {"customer_id": 1, "field2": "doc1", "_index": "my_index"}}
{"create": {"customer_id": 1, "field2": "doc2", "_index": "my_index"}}

It always returns this:

{
  "errors": false,
  "items": []
}

Stepping through things in a debugger takes me into fake_elasticsearch.py where I can see the documents are never added to the internal dictionary. It's almost as if some indentation got messed up.

It goes into this block:

if any(action in line for action in ['index', 'create', 'update', 'delete']):
   -- SNIP! --

...which makes sure the index exists:

                    if index not in self.__documents_dict:
                        self.__documents_dict[index] = list()

So far, so good. But that's where it stops. I mean, everything else that needs to happen is found underneath the following else clause - in particular, the creation of the item and adding it to both the self.__documents_dict[index] and to the items list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions