sql icon indicating copy to clipboard operation
sql copied to clipboard

Support reading value from docvalue

Open jgq2008303393 opened this issue 4 years ago • 3 comments

Would Opendistro SQL support reading docvalue fields? When only a small number of fields are read, performance would be greatly improved. Looking forward to this feature!

jgq2008303393 avatar Dec 18 '20 14:12 jgq2008303393

Thanks for reaching out. Could you give some example that how to use SQL to read docvalue?

penghuo avatar Jan 05 '21 18:01 penghuo

@penghuo Thank you very much for your reply. For GroupBy query, docvalue is used. So this issue mainly focuses on normal select query. IMO, there are two ways to do this:

  • The best way is to automatically choose whether to use source or docvalue based on SQL.
  • Another way is to allow users to choose to read from docvalue as follows:
SELECT DocValue('uid'), DocValue('timestamp'), DocValue('page_views') FROM index;

jgq2008303393 avatar Jan 08 '21 04:01 jgq2008303393

@penghuo Thank you very much for your reply. For GroupBy query, docvalue is used. So this issue mainly focuses on normal select query. IMO, there are two ways to do this:

  • The best way is to automatically choose whether to use source or docvalue based on SQL.
  • Another way is to allow users to choose to read from docvalue as follows:
SELECT DocValue('uid'), DocValue('timestamp'), DocValue('page_views') FROM index;

Thanks for the info! So what kind of ES DSL you expect to generate from the query you proposed? If this only concerns performance, ideally I think our query engine should take care of the performance behind the scene.

dai-chen avatar Mar 01 '21 22:03 dai-chen