ropensci / elastic

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

issue with regex #297

Open randomgambit opened 1 year ago

randomgambit commented 1 year ago

Hello and thanks for this great package. I am having some issues with using regex and elastic.

Consider the following query string

   myquery = ' {"query": { "regexp": { "data.headline.keyword": { "value": ".*hello world.*",
                                               "case_insensitive": True}}}
    }'

This query string works perfectly fine in Python when using opensearch-py. However, when using elastic in R I get an error:

elastic::count(con, q = myquery, index = 'myindex_*')

Error: 400 - all shards failed
ES stack trace:

  type: parse_exception
  reason: parse_exception: Encountered " <RANGE_GOOP> 

Do you know what the issue is? Thanks!

sckott commented 1 year ago

Did you try setting errors="complete" in your https://docs.ropensci.org/elastic/reference/connect.html connect() call? That should give you more error detail i think .

Also you could turn on verbose curl output to see what http requests are being sent to see if they are malformed or not. e.g., https://docs.ropensci.org/crul/reference/crul-options.html crul::set_verbose()