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

unset slice occur #27

Open
EdwardShen125 opened this issue Nov 10, 2021 · 3 comments
Open

unset slice occur #27

EdwardShen125 opened this issue Nov 10, 2021 · 3 comments

Comments

@EdwardShen125
Copy link

Mistakes happened when i migrates docs from one table to another.
source doc like {"A":[], "B":"name"}
result doc like {"B":"name"}
that A field was unset
when param "a" of func "normalizeDocSlice" was a zero length slice that not nil pointer. So the returned var "avs" was a nil.

i guess var avs = make([]interface{}, 0) may solve my problem

@EdwardShen125 EdwardShen125 changed the title nil slice unset slice occur Nov 10, 2021
@rwynn
Copy link
Owner

rwynn commented Nov 10, 2021

I'm not sure there is a difference in Elasticsearch between an empty array and a missing field.

https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html

An array may contain null values, which are either replaced by the configured null_value or skipped entirely. An empty array [] is treated as a missing field — a field with no values.

I could be wrong though.

@rwynn
Copy link
Owner

rwynn commented Nov 11, 2021

Sorry, disregard my last comment. I thought this issue was in a different repository.

I just pushed a fix for this and will create a new release for it.

@EdwardShen125
Copy link
Author

Sorry, disregard my last comment. I thought this issue was in a different repository.

I just pushed a fix for this and will create a new release for it.

that's great!

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