ropensci / elastic

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

Bug in index_create with list body #214

Closed emillykkejensen closed 6 years ago

emillykkejensen commented 6 years ago

When trying to create an index with settings from a list, it gives an error.

Exampel:

body <- list(
  settings = list(
    analysis = list(
      analyzer = list(
        my_analyzer = list(
          type = "standard"
        )
      )
    )
  )
)

index_create(index = "test", body = body)

Will give the error:

Error in curl::handle_setform(handle, .list = req$fields) : 
  Unsupported value type for form field 'settings'.

Where as: index_create(index = "test", body = jsonlite::toJSON(body, auto_unbox = TRUE)) Works fine.

Seems to me, that this line might need to be updated with the es_PUT function? https://github.com/ropensci/elastic/blob/d8b6e9eb084baa89e3df92c630fb4d2450ae878d/R/index.R#L292-L293

sckott commented 6 years ago

thanks @emillykkejensen should be fixed now