<commit_before>h1. elasticshell - a shell for elasticsearch

The elasticshell is a javascript shell written in Java that allows to interact with a running [elasticsearch](http://www.elasticsearch.org) cluster using the [Java API](http://www.elasticsearch.org/guide/reference/java-api/).

h2. Getting Started

h3. Installation
* "Download":http://www.javanna.net/downloads/elasticshell-0.20.5.zip and unzip the elasticshell distribution
* Run @bin/elasticshell@ on unix, or @bin/elasticshell.bat@ on windows

h3. Help
Use the help() command to have a look at the elasticshell help.
Every command is exposed as a javascript function. If you want to read the help for a specific command, just tpe its name without curly brackets.

h3. Auto-suggestions
Make use of the auto-suggestions through the tab key to have a look at the available commands and variables.
JSON is native within the elasticshell, thus auto-suggestions are available within a JSON objects too.

h3. Connecting to a cluster
The elasticshell will automatically try to create a new transport client connected to a node running on localhost:9300.
The default transport client will be registered with the es variable name, same result as the following command:
@var es = transportClient('localhost:9300')@

You can manually connect to a running elasticsearch cluster using the following commands:
* transportClient('hostname:port'): it creates a new "transport client":http://www.elasticsearch.org/guide/reference/java-api/client.html . You can provide a list of addresses too
* nodeClient('clusterName'): it creates a new "node client":http://www.elasticsearch.org/guide/reference/java-api/client.html .

h3. elasticsearch API
All of the elasticsearch API are exposed through the elasticshell, let's see how they can be used.

h3. Let's index a document

<pre>
var jsonDoc = {
   "user": "kimchy",
   "postDate": "2009-11-15T13:12:00",
   "message": "Trying out Elastic Search, so far so good?"
}<commit_msg>improved readme<commit_after>h1. elasticshell - a shell for elasticsearch

The elasticshell is a javascript shell written in Java.
It allows to interact with a running elasticsearch:http://www.elasticsearch.org cluster using the "Java API":http://www.elasticsearch.org/guide/reference/java-api/ .

h2. Getting Started

h3. Installation

* "Download":http://www.javanna.net/downloads/elasticshell-0.20.5.zip and unzip the elasticshell distribution
* Run @bin/elasticshell@ on unix, or @bin/elasticshell.bat@ on windows

h3. Help
Use the help() command to have a look at the elasticshell help.
Every command is exposed as a javascript function. If you want to read the help for a specific command, just tpe its name without curly brackets.

h3. Auto-suggestions
Make use of the auto-suggestions through the tab key to have a look at the available commands and variables.
JSON is native within the elasticshell, thus auto-suggestions are available within a JSON objects too.

h3. Connecting to a cluster
The elasticshell will automatically try to create a new transport client connected to a node running on localhost:9300.
The default transport client will be registered with the es variable name, same result as the following command:
@var es = transportClient('localhost:9300')@

You can manually connect to a running elasticsearch cluster using the following commands:
* transportClient('hostname:port'): it creates a new "transport client":http://www.elasticsearch.org/guide/reference/java-api/client.html . You can provide a list of addresses too
* nodeClient('clusterName'): it creates a new "node client":http://www.elasticsearch.org/guide/reference/java-api/client.html .

h3. elasticsearch API
All of the elasticsearch API are exposed through the elasticshell, let's see how they can be used.

h3. Let's index a document

<pre>
var jsonDoc = {
   "user": "kimchy",
   "postDate": "2009-11-15T13:12:00",
   "message": "Trying out Elastic Search, so far so good?"
}
{'fraction_non_alphanumeric': 0.08043643745242324, 'fraction_numerical': 0.017254503933011926, 'mean_word_length': 4.72133526850508, 'pattern_counts': {'":': 13, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6090031', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1077, 'n_words': 487}