Closed cphaarmeyer closed 3 years ago
Share your R session info and ideally a reproducible example
Edited out the connection Info.
library(elastic)
conn <- connect(...)
conn$es_ver()
#> [1] 561
index_create(conn, index = "tmp")
#> $acknowledged
#> [1] TRUE
#>
#> $shards_acknowledged
#> [1] TRUE
#>
#> $index
#> [1] "tmp"
df <- data.frame(x = 1.23456789)
docs_bulk_index(conn, df,
index = "tmp", type = "tmp", es_ids = FALSE, doc_ids = 1
)
#> | | | 0% | |======================================================================| 100%
#> [[1]]
#> [[1]]$took
#> [1] 26
#>
#> [[1]]$errors
#> [1] FALSE
#>
#> [[1]]$items
#> [[1]]$items[[1]]
#> [[1]]$items[[1]]$index
#> [[1]]$items[[1]]$index$`_index`
#> [1] "tmp"
#>
#> [[1]]$items[[1]]$index$`_type`
#> [1] "tmp"
#>
#> [[1]]$items[[1]]$index$`_id`
#> [1] "1"
#>
#> [[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$created
#> [1] TRUE
#>
#> [[1]]$items[[1]]$index$status
#> [1] 201
docs_get(conn, index = "tmp", type = "tmp", id = 1)
#> $`_index`
#> [1] "tmp"
#>
#> $`_type`
#> [1] "tmp"
#>
#> $`_id`
#> [1] "1"
#>
#> $`_version`
#> [1] 1
#>
#> $found
#> [1] TRUE
#>
#> $`_source`
#> $`_source`$x
#> [1] 1.2346
index_delete(conn, index = "tmp")
#> $acknowledged
#> [1] TRUE
Created on 2021-02-15 by the reprex package (v1.0.0)
@cphaarmeyer should work now. reinstall remotes::install_github("ropensci/elastic")
, and see digits
param https://docs.ropensci.org/elastic/reference/docs_bulk_index.html
Not sure if this is a bug or intended. It caused me some problems.
When using docs_bulk_index on a data frame, only 4 digits actually appeared in the Elasticsearch. This was due to a call of
jsonlite::toJSON
inmake_bulk_
which only keeps 4 digits by default. Maybe setdigits = NA
?In my case I resolved this by writing my own custum function to create a bulk upload textfile. But maybe someone else has a similar problem and I didnt find an issue on this here.