FDA / openfda

openFDA is a research project to provide open APIs, raw data downloads, documentation and examples, and a developer community for an important collection of FDA public datasets.
https://open.fda.gov
Creative Commons Zero v1.0 Universal
567 stars 131 forks source link

[illegal_argument_exception] Fielddata is disabled on text fields by default. #168

Closed oleksandrbyk closed 3 years ago

oleksandrbyk commented 3 years ago

When I call the following API endpoint, I am getting 500 error.

GET https://api.fda.gov/drug/event.json?search=_exists_:seriousnessdeath&count=occurcountry

Response:
{
  "error": {
    "code": "SERVER_ERROR",
    "message": "Check your request and try again",
    "details": "[illegal_argument_exception] Fielddata is disabled on text fields by default. Set fielddata=true on [occurcountry] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
  }
}

How can I resolve the issue?

dkrylovsb commented 3 years ago

https://api.fda.gov/drug/event.json?search=_exists_:seriousnessdeath&count=occurcountry.exact

oleksandrbyk commented 3 years ago

It works. Thank you @dkrylovsb