Accessing SQL API from http(s)

wonder if there are any way to call ES SQL API, say like
http://localhost:9200/_sql?format=json&source={“query”: “SELECT 1” }
similer to
http://localhost:9200//hockey/_search?q=johnny

This gives error. "source and source_content_type parameters are required"

NB:

the following curl script works fine.

curl -X GET "localhost:9200/_sql" -H 'Content-Type: application/json' -d'SELECT 1'

minimal script to create the index

PUT hockey/_bulk?refresh
{"index":{"_id":1}}
{"first":"johnny","last":"gaudreau","goals":[9,27,1],"assists":[17,46,0],"gp":[26,82,1],"born":"1993/08/13"}

@madhusoodanan yes, this is possible:

http://localhost:9200/_sql?source={"query":"SELECT 1"}&source_content_type=application/json&format=txt
1 Like

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