Skip to content

Use SQL syntax to query a custom REST API with ElasticSearch-like parameters

License

Notifications You must be signed in to change notification settings

ryankirkman/sql-es

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sql-es

Use SQL syntax to query a custom REST API with ElasticSearch-like parameters

Install (as a command line util)

npm install sql-es -g

Usage

-h or --host: Host template. Note {product} in the template below. sql-es will substitute in the table value from the SQL query. Note for the host that HTTP will be assumed and prepended.

-q or --query: The SQL query

Usage Example

Simple

sql-es -h host.com/product/{product}/search -q 'SELECT * FROM table WHERE id > 3200 LIMIT 10'

Result

A JSON string with indentation set to 4. Assumes the result of the POST request will be JSON.

Misc

This is super hacked to gether and extremely specific to my use case. Good luck using it on your own.

Just read the source. It's only ~100 lines.

About

Use SQL syntax to query a custom REST API with ElasticSearch-like parameters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published