ropensci / elastic

R client for the Elasticsearch HTTP API
https://docs.ropensci.org/elastic
Other
245 stars 58 forks source link

update write function ( utf8 encoding) #224

Closed Lchiffon closed 6 years ago

Lchiffon commented 6 years ago

fix encoding write function in UTF-8

Related Issue

223

Example

library(elastic)
connect()

a = data.frame(a= '测试', b = 123)
elastic::index_create(index = "test", verbose = TRUE)
elastic::docs_bulk(a, index = "dianping")
[[1]]
[[1]]$took
[1] 22

[[1]]$errors
[1] FALSE

[[1]]$items
[[1]]$items[[1]]
[[1]]$items[[1]]$index
[[1]]$items[[1]]$index$`_index`
[1] "dianping"

[[1]]$items[[1]]$index$`_type`
[1] "dianping"

[[1]]$items[[1]]$index$`_id`
[1] "bmU7F2QBfgMgeBf7JQoo"

[[1]]$items[[1]]$index$`_version`
[1] 1

[[1]]$items[[1]]$index$result
[1] "created"

[[1]]$items[[1]]$index$`_shards`
[[1]]$items[[1]]$index$`_shards`$total
[1] 2

[[1]]$items[[1]]$index$`_shards`$successful
[1] 1

[[1]]$items[[1]]$index$`_shards`$failed
[1] 0

[[1]]$items[[1]]$index$`_seq_no`
[1] 1946

[[1]]$items[[1]]$index$`_primary_term`
[1] 1

[[1]]$items[[1]]$index$status
[1] 201
codecov-io commented 6 years ago

Codecov Report

Merging #224 into master will decrease coverage by 4.24%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #224      +/-   ##
==========================================
- Coverage   56.76%   52.51%   -4.25%     
==========================================
  Files          42       42              
  Lines        1663     1449     -214     
==========================================
- Hits          944      761     -183     
+ Misses        719      688      -31
Impacted Files Coverage Δ
R/docs_bulk_update.R 80.35% <100%> (-5.59%) :arrow_down:
R/docs_bulk_utils.R 79.66% <100%> (-2.03%) :arrow_down:
R/zzz.r 64.04% <100%> (+0.82%) :arrow_up:
R/docs_mget.r 65.3% <0%> (-18.91%) :arrow_down:
R/docs_get.r 68.75% <0%> (-16.25%) :arrow_down:
R/msearch.R 85.71% <0%> (-14.29%) :arrow_down:
R/nodes.R 76.47% <0%> (-13.53%) :arrow_down:
R/cat.r 47.69% <0%> (-10.54%) :arrow_down:
R/docs_bulk.r 82.08% <0%> (-7.53%) :arrow_down:
R/info.R 62.5% <0%> (-7.5%) :arrow_down:
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fb5e03a...1582026. Read the comment docs.

sckott commented 6 years ago

thanks for this!