Troubleshooting

The SQL plugin is stateless, so troubleshooting is mostly focused on why a particular query fails.

The most common error is the dreaded null pointer exception, which can occur during parsing errors or when using the wrong HTTP method (POST vs. GET and vice versa). The POST method and HTTP request body offer the most consistent results:

  1. POST _plugins/_sql
  2. {
  3. "query": "SELECT * FROM my-index WHERE ['name.firstname']='saanvi' LIMIT 5"
  4. }

If a query isn’t behaving the way you expect, use the _explain API to see the translated query, which you can then troubleshoot. For most operations, _explain returns OpenSearch query DSL. For UNION, MINUS, and JOIN, it returns something more akin to a SQL execution plan.

Example request

  1. POST _plugins/_sql/_explain
  2. {
  3. "query": "SELECT * FROM my-index LIMIT 50"
  4. }

Example response

  1. {
  2. "from": 0,
  3. "size": 50
  4. }

Index mapping verification exception

If you see the following verification exception, make sure the index in your query isn’t an index pattern and doesn’t have multiple types:

  1. {
  2. "error": {
  3. "reason": "There was internal problem at backend",
  4. "details": "When using multiple indices, the mappings must be identical.",
  5. "type": "VerificationException"
  6. },
  7. "status": 503
  8. }

If these steps don’t work, submit a Github issue here.