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

pandas_to_eland, dot case columns naming raises a mapper_parsing_exception #344

Closed
OdelinCharron opened this issue Mar 25, 2021 · 1 comment

Comments

@OdelinCharron
Copy link

Hello,

I got a request error when using eland.pandas_to_eland.
This is happening when using this.type.of.column.name. instead of camelCaseNames` (for example).

Eland version: 7.10.1b1
EK stack 7.10.0 (docker)

How to reproduce:

df = pandas.DataFrame({
    "a":[1,2,3,4,5],
    "b":["a","b","c","d","e"],
    "b.c":[1,2,3,4,5]
})
a b b.c
0 1 a 1
1 2 b 2
2 3 c 3
3 4 d 4
4 5 e 5
eland.pandas_to_eland(
    pd_df = df,
    es_client=es,
    es_dest_index="test_eland",
    es_if_exists="replace",
    es_refresh=True,
)

returns:

RequestError: RequestError(400, 'mapper_parsing_exception', 'Failed to parse mapping [_doc]: mapper [b] cannot be changed from type [keyword] to [ObjectMapper]')

There are very quick fix to solve this issue like df.columns = [_c.replace(".","_") for _c in df.columns] but that was not a behavior I expected.

Feel free it close it directly if it's only a lack of culture on my side.

Thanks !

@stevedodson
Copy link
Contributor

stevedodson commented Mar 30, 2021

@OdelinCharron - thanks for the feedback. In Elasticsearch dots are special characters in field names (elastic/elasticsearch#15951). In your example, field b needs to be both a list and an object (b.c implies b: { c: [1,2,3,4,5] }) so Elasticsearch rejects it.

Closing this for now, but happy for more feedback.

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