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

Bulk API not working #73

Open
flashgorman-chorus opened this issue Aug 3, 2021 · 2 comments
Open

Bulk API not working #73

flashgorman-chorus opened this issue Aug 3, 2021 · 2 comments

Comments

@flashgorman-chorus
Copy link

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.

@flashgorman-chorus
Copy link
Author

For clarity, code enters the if block at the top (because the action is create) but never enters the highlighted block where the item gets created. The only way for me to get the code to enter that block would be if the action wasn't index or create or update or delete.

image

@flashgorman-chorus
Copy link
Author

Or maybe it's some block of code inside the first if that it failed to enter - but that block of code is wrapped with if action == delete: - but the code that follows doesn't look like it is delete-specific; it just validates the action and then creates an item, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant