Curl Output is not complete

Hello Team

I am using Elasticsearch Version 7.8.0.

I am executing an query on Elasticsearch index. The output of CURL command is not complete, IT shows incomplete records only.

I suppose there is some limit / default values due to which this output is limited.

curl -X POST "localhost:9200/_sql?format=txt&pretty=true" -H 'Content-Type: application/json' -d'
{
  "query": "SELECT userId from myindex"
}
'

could you please help me in understanding and getting the required output.

Thanks
Tushar Nemade

May be this would help?

Hi David

Thank your for this response and page.

I have been through this page ... it does return cursor as mentioned

{
  "columns" : [
    {
      "name" : "userId",
      "type" : "text"
    }
  ],
  "rows" : [
    [
      "d1527400b8574961b1eb52a37699a42f"
    ],
    [
      "d1527400b8574961b1eb52a37699a42f"
    ],
    [
      "cd83f0a14683405fa22ca5907e9db90b"
    ],
    [
      "d1527400b8574961b1eb52a37699a42f"
    ],
    [
      "7a971150d09e43f0a5a3097010ee13fc"
    ]
  ],
  "cursor" : "o5GwAwFaAXOMA0ZHbHVZMngxWkdWZlkyOXVkR1Y0ZEY5MWRXbGtEbkYxWlhKNVZHaGxia1psZEdOb0JSUlBaakpIZEROVlFuVkJPRWRMV0hKcFRIRlVaZ0FBQUFBQUNuWTBGaTFhYVZWb1QwTnFVbUl0UlVWalUweHZhbG8wV1ZFVVQxQXlSM1F6VlVKMVFUaEhTMWh5YVV4eFZHWUFBQUFBQUFwMk14WXRXbWxWYUU5RGFsSmlMVVZGWTFOTWIycGFORmxSRkU5Zk1rZDBNMVZDZFVFNFIwdFljbWxNY1ZSbUFBQUFBQUFLZGpZV0xWcHBWV2hQUTJwU1lpMUZSV05UVEc5cVdqUlpVUlJQZGpKSGRETlZRblZCT0VkTFdISnBUSEZVWmdBQUFBQUFDblkxRmkxYWFWVm9UME5xVW1JdFJVVmpVMHh2YWxvMFdWRVVVRkF5UjNRelZVSjFRVGhIUzFoeWFVeHhWR1lBQUFBQUFBcDJOeFl0V21sVmFFOURhbEppTFVWRlkxTk1iMnBhTkZsUv////8PAQFmBnVzZXJJZAEGdXNlcklkAQR0ZXh0AAAAAQE="
}

I am using CURL command in my automation script.

How to get this cursor dynamically useful to have all records when I am implementing automation using scripts.

Also this is useful only when you are using format as JSON and not as txt.

I am in need to implement the output in serially so that i can use it for my further processing ...
Thanks
Tushar Nemade

Hi

As of now i m trying using elasticsearch-sql-cli to get the result...

Lets see if i succeed in my achievement , will share in here entire steps and methodology ...

Thanks
Tushar Nemade

Call again the same api with the cursor you got and get the next records until it's done.

This is helpful is I am doing it manually.

How could i get this Cursor value automatically in my script, which will be executing without human intervention.

The first call to the API gives it back, right?

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