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

ESM数据迁移对于long型字段的数据如果长度大于17位,出现了精度丢失问题。 #36

Closed
auzn1025 opened this issue May 11, 2020 · 10 comments

Comments

@auzn1025
Copy link

ESM数据迁移进对于long型字段的数据如果长度大于17位,出现了精度丢失问题。应该是代码中get数据时字符串转Long型出现了bug。

@medcl
Copy link
Owner

medcl commented May 14, 2020

有测试json文档么,提供一个

@auzn1025
Copy link
Author

PUT test_long
{
"mappings": {
"_doc": {
"properties": {
"id": {
"type": "long",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}

GET test_long/_search

PUT test_long/_doc/1
{
"id":244126662931218468
}

注意:这个数字,不能通过kibana put,需要用java程序或者python等写到索引中。直接put最后一位的8就丢失了。用程序正常写入后,再用迁移工具迁移,精度就会丢失了,跟在kibana中put一样,最后一位数字8会变成0.

@medcl medcl closed this as completed in 861db96 May 14, 2020
@medcl
Copy link
Owner

medcl commented May 14, 2020

试试这个,应该可以了。
https://github.com/medcl/esm/releases/tag/v0.4.5-SNAPSHOT

@auzn1025
Copy link
Author

hi:medcl,用新版0.4.5的windows版本迁移,报了这样的错。
[05-15 09:14:29] [ERR] [v6.go:99,NewScroll] json: cannot unmarshal number into Go struct field .hits.total of type struct { Value int "json:"value,omitempty""; Relation string "json:"relation,omitempty"" }
[05-15 09:14:29] [ERR] [main.go:149,main] json: cannot unmarshal number into Go struct field .hits.total of type struct { Value int "json:"value,omitempty""; Relation string "json:"relation,omitempty"" }

@auzn1025
Copy link
Author

验证了linux版本也有这个问题,现在4.5的版本一跑就会出错,请看一下,谢谢
error: json: cannot unmarshal number into Go struct field .hits.total of type struct { Value int "json:"value,omitempty""; Relation string "json:"relation,omitempty"" }
[05-15 09:14:29] [ERR] [v6.go:99,NewScroll] json: cannot unmarshal number into Go struct field .hits.total of type struct { Value int "json:"value,omitempty""; Relation string "json:"relation,omitempty"" }
[05-15 09:14:29] [ERR] [main.go:149,main] json: cannot unmarshal number into Go struct field .hits.total of type struct { Value int "json:"value,omitempty""; Relation string "json:"relation,omitempty"" }

@auzn1025 auzn1025 changed the title ESM数据迁移进对于long型字段的数据如果长度大于17位,出现了精度丢失问题。 ESM数据迁移对于long型字段的数据如果长度大于17位,出现了精度丢失问题。 May 15, 2020
@medcl
Copy link
Owner

medcl commented May 15, 2020

es 什么版本?

@auzn1025
Copy link
Author

6.8.8

@auzn1025
Copy link
Author

6.3.2也是一样的问题

@medcl
Copy link
Owner

medcl commented May 15, 2020

重新下载试试看。

@auzn1025
Copy link
Author

ok,可以了,谢谢

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