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

Add new index with the same id doesn't work #21

Closed
kromash opened this issue Mar 14, 2019 · 0 comments
Closed

Add new index with the same id doesn't work #21

kromash opened this issue Mar 14, 2019 · 0 comments

Comments

@kromash
Copy link

kromash commented Mar 14, 2019

Hello,

I'm wondering why adding new index with the same id does not replace previous index. I found out that entry with the same id is appended to list and then when using get it returns first entry that was inserted instead of last.

For example following test fails:

@elasticmock
def test_es_mock():
    es_mock = elasticsearch.Elasticsearch(hosts=[{'host': 'localhost', 'port': 9200}])

    es_mock.index(index='m', doc_type='t', id='1', body={'test': 1})
    es_mock.index(index='m', doc_type='t', id='1', body={'test': 3})
    es_reposne = es_mock.get(index='m', doc_type='t', id='1')
    found_doc = es_reposne['_source']
    assert found_doc['test'] == 3
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

2 participants