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

Optionally disable verify_mapping_compatibility in pandas_to_eland append #412

Closed
stevedodson opened this issue Nov 18, 2021 · 0 comments · Fixed by #423
Closed

Optionally disable verify_mapping_compatibility in pandas_to_eland append #412

stevedodson opened this issue Nov 18, 2021 · 0 comments · Fixed by #423

Comments

@stevedodson
Copy link
Contributor

When converting pandas DataFrames and appending to ES index, the current implementation is strict and enforces compatibility between the pandas DataFrame and the ES mapping.

A use case is multiple pandas DataFrames are appended to an ES index. For example,

df1 = pd.DataFrame(data={'key': ['test'], 'value1': [10] })
df2 = pd.DataFrame(data={'key': ['test'], 'value2': [20] })

ed.pandas_to_eland(df1, es_client, es_index, es_dropna=True, 
                               es_if_exists='append', use_pandas_index_for_es_ids=False)

# currently throws ValueError
ed.pandas_to_eland(df2, es_client, es_index, es_dropna=True, 
                               es_if_exists='append', use_pandas_index_for_es_ids=False)

It can be useful to disable this strict behaviour so new dynamic mappings can be created in the ES index. This would result in:

ed.DataFrame(es_client, es_index)

    key  value1  value2
0  test    10.0     NaN
1  test     NaN    20.0

Therefore, an option is to add an argument such as verify_mapping_compatibility: False

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

Successfully merging a pull request may close this issue.

1 participant