Elasticsearch SQL CLI

Hello Team

I am using Elasticsearch version 7.8.0.

I am using elasticsearch-sql-cli ; to perform my operations on elasticsearch index.

When I am using this and redirecting its output to a logfile , its output contains

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
                     ElasticE  sticEla
          sticEl  ticEl            Elast
        lasti Elasti                   tic
      cEl       ast                     icE
     icE        as                       cEl
     icE        as                       cEl
     icEla     las                        El
   sticElasticElast                     icElas
 las           last                    ticElast
El              asti                 asti    stic
El              asticEla           Elas        icE
El            Elas  cElasticE   ticEl           cE
Ela        ticEl         ticElasti              cE
 las     astic               last              icE
   sticElas                   asti           stic
     icEl                      sticElasticElast
     icE                       sticE   ticEla
     icE                       sti       cEla
     icEl                      sti        Ela
      cEl                      sti       cEl
       Ela                    astic    ticE
         asti               ElasticElasti
           ticElasti  lasticElas


My Command is :

echo "select userId from myindex;" | elasticsearch-sql-cli -s http://elastic:elastic@localhost:9200 | tee myindex_userids.log

Could you please help me , how to get rid of this. I want only index data in my output file.

Tushar Nemade

The tool will always print the header, currently. Feel free to open an issue asking for a parameter to execute one query on GH, though.
But you can of course pipe the output through smth like tail -n +30 to strip those first 30 lines (or whatever the right number).

But this Number say for example +30 , would change in future release ... as my Script would execute for given Elasticsearch Cluster which will be upgraded in future based on requirements and bug fixes.

This would be unstable solution for my implementations.

--silent option which is given is of no use , as it should have suppressed such things.

Also there is no option for redirecting the output to a file , so that what ever data is extracted would be captured in a log file.


As of now I am using below sed commands to erase the BANNER , sql> prompt from the output logfile.

sed -i '1,/sql>/d' ${LOG_DIR}/myindex_${DATE}.log          ## remove top lines till sql prompt
sed -i '1d; $d' ${LOG_DIR}/myindex_${DATE}.log             ## remove last line which has sql prompt

My work is done using these commands .. but I wonder this should not create any other issue in coming days ..

Tushar Nemade

Also I do not have github login ... hence as of now I cannot raise this in it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.