sql icon indicating copy to clipboard operation
sql copied to clipboard

[FEATURE] [IMPROVEMENT] PPL Error needs improvement

Open Jon-AtAWS opened this issue 2 years ago • 4 comments

Is your feature request related to a problem?

I am writing PPL to query an index and just display some fields. If I run

source=moviegeek-logs-*

I see fields like trace_id, method, span_id, index

I can run source=moviegeek-logs-* | fields trace_id, span_id, method and get the expected table.

If I add index: source=moviegeek-logs-* | fields trace_id, span_id, method, index I get the following error in the output panel:

Events: Bad Request, this query is not runnable.

  1. Is there something special about the "index" field?
  2. A better error message here would be invaluable.

What solution would you like?

Better error messaging around syntax and other problems

What alternatives have you considered?

None

Do you have any additional context?

None

Jon-AtAWS avatar Jul 04 '22 19:07 Jon-AtAWS

Every time I need to understand why it's failing, I need to do it directly via API. This makes it cumbersome to use the Workbench.

Example: POST /_opendistro/_ppl { "query": """ source=opensearch_dashboards_sample_data_logs | fields host, clientip, response, bytes | where response='503' or response='404' """ }

rafael-gumiero avatar Aug 05 '22 18:08 rafael-gumiero

Meta fields are not available for querying at the moment. I think your issue is very similar to #639, #432 and #339.

Yury-Fridlyand avatar Aug 05 '22 18:08 Yury-Fridlyand

There was issue and PR for the second question regarding error message: https://github.com/opendistro-for-elasticsearch/sql/pull/872

But later the changes were reverted for some reason: https://github.com/opensearch-project/sql/commit/5cea8b4e3dcac16eb2efa07a18712322eab490e3

dai-chen avatar Aug 05 '22 19:08 dai-chen

@Yury-Fridlyand "index" in this case was a field on the document, not the meta field.

Jon-AtAWS avatar Oct 02 '22 17:10 Jon-AtAWS