ropensci / elastic

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

Use source_excludes in docs_get #246

Closed Jensxy closed 5 years ago

Jensxy commented 5 years ago

Hi guys,

I like to use source_excludes in the docs_get function. Something similar to GET twitter/_doc/1/_source?_source_includes=*.id&_source_excludes=entities. Is that somehow possible? I want to use docs_get because I think it is faster than Search to retrieve exactly one document, right?

If I would use Search, I would use the following body.

    body <- '{
                   "query": {
                   "ids" : {
                   "values" : ["id_1"]
                   }
                   },
                   "_source": {
                   "excludes": ["source_1", "source_2"]
                   }
  }'

Best regards, Jens

sckott commented 5 years ago

thanks, i'll take a look soon

sckott commented 5 years ago

i don't know which is faster, haven't compared times.

sckott commented 5 years ago

added, on branch r6-conn, remotes::install_github("ropensci/elastic@r6-conn")