elasticsearchr
elasticsearchr copied to clipboard
list_fields() always returns NULL
Hi,
I am trying to use the functions you listed in CRAN, everything seems to work pretty fine except the list_fields() using %info% infix.
I tried with the tidyverse mpg dataset to play small.

I use the version 7.4.0 of Elasticsearch (the latest).
Do I miss something?
Found it.
In the file R/api.R, list_fields() function, line 189:
fields <- names(index_mapping[[1]]$mappings$data$properties)
must be changed by:
fields <- names(index_mapping[[1]]$mappings$properties)
When performed:

pull request sent, however I forgot to mention: it only works with ES 7.
Taking the same dataset as example (mpg from tidyverse), all the minor versions of ES have differences :
With ES 7.4.0: executing curl http://localhost:9200/mpg/_mapping?pretty
{
"mpg" : {
"mappings" : {
"properties" : {
"class" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"cty" : {
"type" : "long"
},
...
}
The hierarchy to reach fields name is: mpg > mappings > properties
With ES 6.8.3: executing curl http://localhost:9200/mpg/_mapping?pretty
{
"mpg" : {
"mappings" : {
"mpg" : {
"properties" : {
"class" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
....
}
The hierarchy to reach fields name is: mpg > mappings > mpg > properties
Yes, some serious development (together with a cogent plan), is required to make elasticsearchr compatible with ES 7.x.