Skip to main content

SQL-like command line client for ElasticSearch

Project description

elseql
======
You know, for Query
-------------------
A SQL-like command line / REPL client for ElasticSearch

### USAGE

elseql [--debug] [--port=host:port]

### COMMANDS

* select - see SEARCH SYNTAX
* describe [index]
* set options [on|off]
* help

### SEARCH SYNTAX

SELECT {fields}
[FACETS facet-fields]
[SCRIPT script-field = 'script']
FROM index
[WHERE where-condition]
[FILTER filter-condition]
[ORDERY BY order-fields]
[LIMIT [start,] count]

where:
fields: '*' or comma-separated list of field names to be returned

facet-fields: comma-separated list of fields to execute a facet query on

script-field: name of script field, to be used in select clause
script: ElasticSearch script

index: index to query

where-condition:
{field-name} [ = != > >= < <= ] {value}
{field-name} LIKE {value}
{field-name} IN (value1, value2, ...)
{field-name} BETWEEN {min-value} AND {max-value}
NOT {where-condition}
{where-condition} AND {where-condition}
{where-condition} OR {where-condition}

or where-condition:
'query in Lucene syntax'

filter-condition:
QUERY {where-condition} - query filter, same syntax as where condition
EXIST {field-name} - exists field filter
MISSING {field.name} - missing field filter

order-fields: comma-separated list of {field-name} [ASC | DESC]

start: start index for pagination
count: maximum number of returned results

A special case for LIMIT start,count allows to do a "scroll" query (i.e. results will be returned in batches):

start: -1 - enable "scroll" query
count: batch size - the query will return {count} results (actually {count} per shard) and will be repeated until all results are returned.

This is very useful when you are expecting large result sets (or you are doing a full table scan). Note that in
"scroll" mode sort and facets are disabled.

### INSTALLATION

From pypi:

sudo easy_install elseql
or:

sudo pip install elseql

With python and setuptools installed:

sudo python setup.py install

You can also run the command without installing as:

python -m elseql.elseql

To do this you will need the pyparsing, rawes and cmd2 packages installed, that are automatically installed in the previous step.

sudo easy_install pyparsing
sudo easy_install rawes
sudo easy_install cmd2

The cmd2 package add a few extra features "command-line" related features. The most useful is redirection:

elsesql> select id,field1,field2 from index where condition > result.csv

Note that because '>' is used for redirection you'll need to use GT in the where clause insted (also available LT, GTE, LTE)

### SEE ALSO

http://elasticsearch.org/, You know, for Search

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elseql-0.3.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

elseql-0.3.0-py2.7.egg (24.6 kB view details)

Uploaded Egg

File details

Details for the file elseql-0.3.0.tar.gz.

File metadata

  • Download URL: elseql-0.3.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for elseql-0.3.0.tar.gz
Algorithm Hash digest
SHA256 811de2b69af25bd31318ab612ba5598c93ba34a245b5fedb9131de15aa5af843
MD5 201c95ce4e480af549dc0662875c1c92
BLAKE2b-256 933c1c28eab2d1bee31779bbb302ea8b92cc4866c2bb4151c855f58f98c0e968

See more details on using hashes here.

File details

Details for the file elseql-0.3.0-py2.7.egg.

File metadata

  • Download URL: elseql-0.3.0-py2.7.egg
  • Upload date:
  • Size: 24.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for elseql-0.3.0-py2.7.egg
Algorithm Hash digest
SHA256 b050f6c1f9d7ed3ab41aaf86f6c6e22db844eb4e187142ac5e3fbd6d753c932a
MD5 013f851be6bf483669e2035edc39dd06
BLAKE2b-256 75b5de1f1e4d6f5071a5d716c8969c310f21bbe7ce849c21d383969b51e85431

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page