diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000..ee771938
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index d852dbc8..cced487f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,4 +18,6 @@ elasticsearch-sql.iml
.idea
src/_site/vendor/codemirror/mode/jinja2/.goutputstream-*
src/_site/node_modules
+src/site-server/node_modules
*~
+.DS_Store
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 3ada6688..158702ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,16 +2,21 @@ language: java
jdk:
- oraclejdk8
- - oraclejdk7
- - openjdk7
-
before_install:
- - wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.1.deb && sudo dpkg -i --force-confnew elasticsearch-1.4.1.deb
-
-services:
- - elasticsearch
+ # update to java 8
+ - sudo update-java-alternatives -s java-8-oracle
+ - export JAVA_HOME=/usr/lib/jvm/java-8-oracle
+ - wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.1.deb && sudo dpkg -i --force-confnew elasticsearch-6.7.1.deb
+ - sudo cp ./src/test/resources/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
+ - sudo cat /etc/elasticsearch/elasticsearch.yml
+ - sudo java -version
+ - sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
+ - sudo service elasticsearch start
+ - sleep 30
+install:
+ - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true
script:
- ulimit -a
diff --git a/BUILDING.md b/BUILDING.md
new file mode 100644
index 00000000..60bff575
--- /dev/null
+++ b/BUILDING.md
@@ -0,0 +1,26 @@
+## Building
+
+To build zip release of the plugin, run this command:
+
+
+````
+mvn clean package assembly:single -DskipTests
+````
+
+Running this command will create zip release named elasticsearch-sql-{version}.zip under 'target' directory. which can be installed from the file system using elasticsearch plugin bash script:
+
+````
+./bin/plugin -u file:///home/omershelef/IdeaProjects/elasticsearch-sql/target/elasticsearch-sql-1.3.2.zip --install sql
+
+````
+
+
+## Tests
+
+To run the tests, you will need elasticsearch instance running on your local machine. Alternatively you can set the environment variables ES_TEST_HOST and ES_TEST_PORT to point the tests to some other elasticsearch instance instead local machine on default port 9200.
+To run the test all you need is running:
+
+````
+mvn test
+
+````
\ No newline at end of file
diff --git a/README.md b/README.md
index ee69c377..1723e676 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,114 @@
Elasticsearch-SQL
=================
+### build status
+
+**1.7.6** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.0.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.1.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.1.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.1.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.2.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**2.2.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.3.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.3.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.3.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.3.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.3.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**2.3.5** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**2.4.5** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**2.4.6** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.0.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.1.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.1.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.2.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.2.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.2.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.3.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.3.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.3.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.3.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.4.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.4.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.4.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.4.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.5.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.5.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.5.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.5.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.6.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.5** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.6** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.7** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.8** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.9** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.6.10** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.11** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.12** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.13** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.14** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**5.6.15** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**5.6.16** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.0.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.0.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.1.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.1.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.1.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**6.1.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.1.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.2.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.2.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.2.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.2.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**6.2.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.3.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.3.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.3.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.4.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.4.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**6.4.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.4.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.5.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.5.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.5.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.5.3** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
+**6.5.4** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.6.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.6.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.6.2** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.7.0** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+**6.7.1** [](https://travis-ci.org/NLPchina/elasticsearch-sql)
+
Query elasticsearch using familiar SQL syntax.
You can also use ES functions in SQL.
+**Check out our [wiki!](https://github.com/NLPchina/elasticsearch-sql/wiki)**
+
+## explain example
+you can visite : [http://essql.nlpcn.org/](http://essql.nlpcn.org/) , it is a sample example for explain
## Web frontend overview
@@ -14,34 +118,530 @@ You can also use ES functions in SQL.
## SETUP
Install as plugin:
+Versions
+------------
+
+| elasticsearch version | latest version | remarks | branch |
+| --------------------- | ------------- | ----------------------------- | ------------ |
+| 1.x | 1.7.6 | tested against elastic 1.7.6 | elastic1.x |
+| 2.0.0 | 2.0.4 | delete commands not supported | elastic2.0 |
+| 2.1.0 | 2.1.0.2 | delete commands not supported | elastic2.1 |
+| 2.1.1 | 2.1.1.1 | delete commands not supported | elastic2.1.1 |
+| 2.1.2 | 2.1.2.0 | delete commands not supported | elastic2.1.2 |
+| 2.2.0 | 2.2.0.1 | delete commands not supported | elastic2.2.0 |
+| 2.2.1 | 2.2.1.0 | delete commands not supported | elastic2.2.1 |
+| 2.3.0 | 2.3.0.0 | delete commands not supported | elastic2.3.0 |
+| 2.3.1 | 2.3.1.1 | delete commands not supported | elastic2.3.1 |
+| 2.3.2 | 2.3.2.0 | delete commands not supported | elastic2.3.2 |
+| 2.3.3 | 2.3.3.0 | delete commands not supported | elastic2.3.3 |
+| 2.3.4 | 2.3.4.0 | delete commands not supported | elastic2.3.4 |
+| 2.3.5 | 2.3.5.0 | delete commands not supported | elastic2.3.5 |
+| 2.4.0 | 2.4.0.1 | delete commands not supported | elastic2.4.0 |
+| 2.4.1 | 2.4.1.0 | delete commands not supported | elastic2.4.1 |
+| 2.4.2 | 2.4.2.1 | delete commands not supported | elastic2.4.2 |
+| 2.4.3 | 2.4.3.0 | delete commands not supported | elastic2.4.3 |
+| 2.4.4 | 2.4.4.0 | delete commands not supported | elastic2.4.4 |
+| 2.4.5 | 2.4.5.0 | delete commands not supported | elastic2.4.5 |
+| 2.4.6 | 2.4.6.0 | delete commands not supported | elastic2.4.6 |
+| 5.0.1 | 5.0.1.0 | delete commands not supported | elastic5.0.1 |
+| 5.1.1 | 5.1.1.0 | delete commands not supported | elastic5.1.1 |
+| 5.1.2 | 5.1.2.0 | delete commands not supported | elastic5.1.2 |
+| 5.2.0 | 5.2.0.0 | delete commands not supported | elastic5.2.0 |
+| 5.2.1 | 5.2.1.0 | delete commands not supported | elastic5.2.1 |
+| 5.2.2 | 5.2.2.0 | delete commands not supported | elastic5.2.2 |
+| 5.3.0 | 5.3.0.0 | delete commands not supported | elastic5.3.0 |
+| 5.3.1 | 5.3.1.0 | delete commands not supported | elastic5.3.1 |
+| 5.3.2 | 5.3.2.0 | delete commands not supported | elastic5.3.2 |
+| 5.3.3 | 5.3.3.0 | delete commands not supported | elastic5.3.3 |
+| 5.4.0 | 5.4.0.0 | delete commands not supported | elastic5.4.0 |
+| 5.4.1 | 5.4.1.0 | delete commands not supported | elastic5.4.1 |
+| 5.4.2 | 5.4.2.0 | delete commands not supported | elastic5.4.2 |
+| 5.4.3 | 5.4.3.0 | delete commands not supported | elastic5.4.3 |
+| 5.5.0 | 5.5.0.1 | delete commands not supported | elastic5.5.0 |
+| 5.5.1 | 5.5.1.0 | delete commands not supported | elastic5.5.1 |
+| 5.5.2 | 5.5.2.0 | delete commands not supported | elastic5.5.2 |
+| 5.5.3 | 5.5.3.0 | delete commands not supported | elastic5.5.3 |
+| 5.6.0 | 5.6.0.0 | delete commands not supported | elastic5.6.0 |
+| 5.6.1 | 5.6.1.0 | delete commands not supported | elastic5.6.1 |
+| 5.6.2 | 5.6.2.0 | delete commands not supported | elastic5.6.2 |
+| 5.6.3 | 5.6.3.0 | delete commands not supported | elastic5.6.3 |
+| 5.6.4 | 5.6.4.0 | delete commands not supported | elastic5.6.4 |
+| 5.6.5 | 5.6.5.0 | delete commands not supported | elastic5.6.5 |
+| 5.6.6 | 5.6.6.0 | | elastic5.6.6 |
+| 5.6.7 | 5.6.7.0 | | elastic5.6.7 |
+| 5.6.8 | 5.6.8.0 | | elastic5.6.8 |
+| 5.6.9 | 5.6.9.0 | | elastic5.6.9 |
+| 5.6.10 | 5.6.10.0 | | elastic5.6.10|
+| 5.6.11 | 5.6.11.0 | | elastic5.6.11|
+| 5.6.12 | 5.6.12.0 | | elastic5.6.12|
+| 5.6.13 | 5.6.13.0 | | elastic5.6.13|
+| 5.6.14 | 5.6.14.0 | | elastic5.6.14|
+| 5.6.15 | 5.6.15.0 | | elastic5.6.15|
+| 5.6.16 | 5.6.16.0 | | elastic5.6.16|
+| 6.0.0 | 6.0.0.0 | | elastic6.0.0 |
+| 6.0.1 | 6.0.1.0 | | elastic6.0.1 |
+| 6.1.0 | 6.1.0.0 | | elastic6.1.0 |
+| 6.1.1 | 6.1.1.0 | | elastic6.1.1 |
+| 6.1.2 | 6.1.2.0 | | elastic6.1.2 |
+| 6.1.3 | 6.1.3.0 | | elastic6.1.3 |
+| 6.1.4 | 6.1.4.0 | | elastic6.1.4 |
+| 6.2.0 | 6.2.0.0 | | elastic6.2.0 |
+| 6.2.1 | 6.2.1.0 | | elastic6.2.1 |
+| 6.2.2 | 6.2.2.0 | | elastic6.2.2 |
+| 6.2.3 | 6.2.3.0 | | elastic6.2.3 |
+| 6.2.4 | 6.2.4.0 | | elastic6.2.4 |
+| 6.3.0 | 6.3.0.0 | | elastic6.3.0 |
+| 6.3.1 | 6.3.1.0 | | elastic6.3.1 |
+| 6.3.2 | 6.3.2.0 | | elastic6.3.2 |
+| 6.4.0 | 6.4.0.0 | | elastic6.4.0 |
+| 6.4.1 | 6.4.1.0 | | elastic6.4.1 |
+| 6.4.2 | 6.4.2.0 | | elastic6.4.2 |
+| 6.4.3 | 6.4.3.0 | | elastic6.4.3 |
+| 6.5.0 | 6.5.0.0 | | elastic6.5.0 |
+| 6.5.1 | 6.5.1.0 | | elastic6.5.1 |
+| 6.5.2 | 6.5.2.0 | | elastic6.5.2 |
+| 6.5.3 | 6.5.3.0 | | elastic6.5.3 |
+| 6.5.4 | 6.5.4.0 | | elastic6.5.4 |
+| 6.6.0 | 6.6.0.0 | | elastic6.6.0 |
+| 6.6.1 | 6.6.1.0 | | elastic6.6.1 |
+| 6.6.2 | 6.6.2.0 | | elastic6.6.2 |
+| 6.7.0 | 6.7.0.0 | | elastic6.7.0 |
+| 6.7.1 | 6.7.1.0 | | elastic6.7.1 |
+
+### Elasticsearch 1.x
+````
+./bin/plugin -u https://github.com/NLPchina/elasticsearch-sql/releases/download/1.7.6/elasticsearch-sql-1.7.6.zip --install sql
+````
+### Elasticsearch 2.0.0
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.0.4/elasticsearch-sql-2.0.4.zip
+````
+### Elasticsearch 2.1.0
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.1.0.2/elasticsearch-sql-2.1.0.2.zip
+````
+### Elasticsearch 2.1.1
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.1.1.1/elasticsearch-sql-2.1.1.1.zip
+````
+### Elasticsearch 2.1.2
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.1.2.0/elasticsearch-sql-2.1.2.0.zip
+````
+### Elasticsearch 2.2.0
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.2.0.1/elasticsearch-sql-2.2.0.1.zip
+````
+### Elasticsearch 2.2.1
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.2.1.0/elasticsearch-sql-2.2.1.0.zip
+````
+### Elasticsearch 2.3.0
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.0.0/elasticsearch-sql-2.3.0.0.zip
+````
+### Elasticsearch 2.3.1
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.1.1/elasticsearch-sql-2.3.1.1.zip
+````
+### Elasticsearch 2.3.2
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.2.0/elasticsearch-sql-2.3.2.0.zip
+````
+### Elasticsearch 2.3.3
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.3.0/elasticsearch-sql-2.3.3.0.zip
+````
+### Elasticsearch 2.3.4
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.4.0/elasticsearch-sql-2.3.4.0.zip
+````
+### Elasticsearch 2.3.5
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.3.5.0/elasticsearch-sql-2.3.5.0.zip
+````
+### Elasticsearch 2.4.0
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.0.1/elasticsearch-sql-2.4.0.1.zip
+````
+### Elasticsearch 2.4.1
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.1.0/elasticsearch-sql-2.4.1.0.zip
+````
+### Elasticsearch 2.4.2
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.2.1/elasticsearch-sql-2.4.2.1.zip
+````
+### Elasticsearch 2.4.3
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.3.0/elasticsearch-sql-2.4.3.0.zip
+````
+### Elasticsearch 2.4.4
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.4.0/elasticsearch-sql-2.4.4.0.zip
+````
+### Elasticsearch 2.4.5
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.5.0/elasticsearch-sql-2.4.5.0.zip
+````
+
+### Elasticsearch 2.4.6
+````
+./bin/plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.6.0/elasticsearch-sql-2.4.6.0.zip
+````
+
+
+### Elasticsearch 5.0.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.0.1/elasticsearch-sql-5.0.1.0.zip
+````
+
+### Elasticsearch 5.1.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.1.0/elasticsearch-sql-5.1.1.0.zip
+````
+
+### Elasticsearch 5.1.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.2.0/elasticsearch-sql-5.1.2.0.zip
+````
+
+### Elasticsearch 5.2.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.2.0.0/elasticsearch-sql-5.2.0.0.zip
+````
+
+### Elasticsearch 5.2.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.2.1.0/elasticsearch-sql-5.2.1.0.zip
+````
+
+### Elasticsearch 5.2.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.2.2.0/elasticsearch-sql-5.2.2.0.zip
+````
+
+### Elasticsearch 5.3.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.3.0.0/elasticsearch-sql-5.3.0.0.zip
+````
+
+### Elasticsearch 5.3.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.3.1.0/elasticsearch-sql-5.3.1.0.zip
+````
+
+### Elasticsearch 5.3.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.3.2.0/elasticsearch-sql-5.3.2.0.zip
+````
+
+### Elasticsearch 5.3.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.3.3.0/elasticsearch-sql-5.3.3.0.zip
+````
+
+### Elasticsearch 5.4.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.0.0/elasticsearch-sql-5.4.0.0.zip
+````
+
+### Elasticsearch 5.4.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/elasticsearch-sql-5.4.1.0.zip
+````
+
+### Elasticsearch 5.4.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.2.0/elasticsearch-sql-5.4.2.0.zip
+````
+
+### Elasticsearch 5.4.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.3.0/elasticsearch-sql-5.4.3.0.zip
+````
+
+### Elasticsearch 5.5.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.5.0.0/elasticsearch-sql-5.5.0.1.zip
+````
+
+### Elasticsearch 5.5.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.5.1.0/elasticsearch-sql-5.5.1.0.zip
+````
+
+### Elasticsearch 5.5.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.5.2.0/elasticsearch-sql-5.5.2.0.zip
+````
+
+### Elasticsearch 5.5.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.5.3.0/elasticsearch-sql-5.5.3.0.zip
+````
+
+### Elasticsearch 5.6.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.0.0/elasticsearch-sql-5.6.0.0.zip
+````
+
+### Elasticsearch 5.6.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.1.0/elasticsearch-sql-5.6.1.0.zip
+````
+
+### Elasticsearch 5.6.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.2.0/elasticsearch-sql-5.6.2.0.zip
+````
+
+### Elasticsearch 5.6.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.3.0/elasticsearch-sql-5.6.3.0.zip
+````
+
+### Elasticsearch 5.6.4
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.4.0/elasticsearch-sql-5.6.4.0.zip
+````
+
+### Elasticsearch 5.6.5
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.5.0/elasticsearch-sql-5.6.5.0.zip
+````
+
+### Elasticsearch 5.6.6
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.6.0/elasticsearch-sql-5.6.6.0.zip
+````
+
+### Elasticsearch 5.6.7
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.7.0/elasticsearch-sql-5.6.7.0.zip
+````
+
+### Elasticsearch 5.6.8
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.8.0/elasticsearch-sql-5.6.8.0.zip
+````
+
+### Elasticsearch 5.6.9
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.9.0/elasticsearch-sql-5.6.9.0.zip
+````
+
+### Elasticsearch 5.6.10
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.10.0/elasticsearch-sql-5.6.10.0.zip
+````
+
+### Elasticsearch 5.6.11
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.11.0/elasticsearch-sql-5.6.11.0.zip
+````
+
+### Elasticsearch 5.6.12
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.12.0/elasticsearch-sql-5.6.12.0.zip
+````
+
+### Elasticsearch 5.6.13
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.13.0/elasticsearch-sql-5.6.13.0.zip
+````
+
+### Elasticsearch 5.6.14
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.14.0/elasticsearch-sql-5.6.14.0.zip
+````
+
+### Elasticsearch 5.6.15
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.15.0/elasticsearch-sql-5.6.15.0.zip
+````
+
+### Elasticsearch 5.6.16
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.16.0/elasticsearch-sql-5.6.16.0.zip
+````
+
+### Elasticsearch 6.0.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.0.0.0/elasticsearch-sql-6.0.0.0.zip
+````
+
+### Elasticsearch 6.0.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.0.1.0/elasticsearch-sql-6.0.1.0.zip
+````
+
+### Elasticsearch 6.1.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.1.0.0/elasticsearch-sql-6.1.0.0.zip
+````
+
+### Elasticsearch 6.1.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.1.1.0/elasticsearch-sql-6.1.1.0.zip
+````
+
+### Elasticsearch 6.1.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.1.2.0/elasticsearch-sql-6.1.2.0.zip
+````
+
+### Elasticsearch 6.1.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.1.3.0/elasticsearch-sql-6.1.3.0.zip
+````
+
+### Elasticsearch 6.1.4
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.1.4.0/elasticsearch-sql-6.1.4.0.zip
+````
+
+### Elasticsearch 6.2.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.0.0/elasticsearch-sql-6.2.0.0.zip
+````
+
+### Elasticsearch 6.2.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.1.0/elasticsearch-sql-6.2.1.0.zip
+````
+
+### Elasticsearch 6.2.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.2.0/elasticsearch-sql-6.2.2.0.zip
+````
+
+### Elasticsearch 6.2.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.3.0/elasticsearch-sql-6.2.3.0.zip
+````
+
+### Elasticsearch 6.2.4
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.4.0/elasticsearch-sql-6.2.4.0.zip
+````
+
+### Elasticsearch 6.3.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.3.0.0/elasticsearch-sql-6.3.0.0.zip
+````
+
+### Elasticsearch 6.3.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.3.1.0/elasticsearch-sql-6.3.1.1.zip
+````
+
+### Elasticsearch 6.3.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.3.2.0/elasticsearch-sql-6.3.2.0.zip
+````
+
+### Elasticsearch 6.4.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.4.0.0/elasticsearch-sql-6.4.0.0.zip
+````
+
+### Elasticsearch 6.4.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.4.1.0/elasticsearch-sql-6.4.1.0.zip
+````
+
+### Elasticsearch 6.4.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.4.2.0/elasticsearch-sql-6.4.2.0.zip
+````
+
+### Elasticsearch 6.4.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.4.3.0/elasticsearch-sql-6.4.3.0.zip
+````
+
+### Elasticsearch 6.5.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.5.0.0/elasticsearch-sql-6.5.0.0.zip
+````
+
+### Elasticsearch 6.5.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.5.1.0/elasticsearch-sql-6.5.1.0.zip
+````
+
+### Elasticsearch 6.5.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.5.2.0/elasticsearch-sql-6.5.2.0.zip
+````
+
+### Elasticsearch 6.5.3
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.5.3.0/elasticsearch-sql-6.5.3.0.zip
+````
+
+### Elasticsearch 6.5.4
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.5.4.0/elasticsearch-sql-6.5.4.0.zip
+````
+
+### Elasticsearch 6.6.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.6.0.0/elasticsearch-sql-6.6.0.0.zip
+````
+
+### Elasticsearch 6.6.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.6.1.0/elasticsearch-sql-6.6.1.0.zip
+````
-###Elasticsearch 1.4.X
+### Elasticsearch 6.6.2
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.6.2.0/elasticsearch-sql-6.6.2.0.zip
````
-./bin/plugin -u https://github.com/NLPchina/elasticsearch-sql/releases/download/1.3.1/elasticsearch-sql-1.3.1.zip --install sql
+### Elasticsearch 6.7.0
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.7.0.0/elasticsearch-sql-6.7.0.0.zip
+````
+### Elasticsearch 6.7.1
+````
+./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.7.1.0/elasticsearch-sql-6.7.1.0.zip
````
+
+After doing this, you need to restart the Elasticsearch server. Otherwise you may get errors like `Invalid index name [sql], must not start with '']; ","status":400}`.
+
## Basic Usage
-* Visit The elasticsearch-sql web front end:
+On elasticsearch 1.x / 2.x, visit the elasticsearch-sql web front-end:
+
````
http://localhost:9200/_plugin/sql/
````
+On elasticsearch 5.x/6.x, use [elasticsearch sql site chrome extension](https://github.com/shi-yuan/elasticsearch-sql-site-chrome) (make sure to enable cors on elasticsearch.yml). Alternatively, [download and extract site](https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip), then start the web front-end like this:
+
+```shell
+cd site-server
+npm install express --save
+node node-server.js
+```
* Simple query
````
-http://localhost:9200/_sql?sql=select * from indexName limit 10
+curl -X GET "localhost:9200/_sql" -H 'Content-Type: application/json' -d'select * from indexName limit 10'
````
* Explain SQL to elasticsearch query DSL
````
-http://localhost:9200/_sql/_explain?sql=select * from indexName limit 10
+curl -X GET "localhost:9200/_sql/_explain" -H 'Content-Type: application/json' -d'select * from indexName limit 10'
````
-## SQL Usuage
+## SQL Usage
* Query
@@ -57,14 +657,14 @@ http://localhost:9200/_sql/_explain?sql=select * from indexName limit 10
DELETE FROM bank WHERE age >30 AND gender = 'm'
-> ###Beyond sql
+## Beyond SQL
* Search
SELECT address FROM bank WHERE address = matchQuery('880 Holmes Lane') ORDER BY _score DESC LIMIT 3
-* Group by aggregation
+* Aggregations
+ range age group 20-25,25-30,30-35,35-40
@@ -78,23 +678,27 @@ http://localhost:9200/_sql/_explain?sql=select * from indexName limit 10
SELECT online FROM online GROUP BY date_range(field='insert_time','format'='yyyy-MM-dd' ,'2014-08-18','2014-08-17','now-8d','now-7d','now-6d','now')
+* ES Geographic
+
+ SELECT * FROM locations WHERE GEO_BOUNDING_BOX(fieldname,100.0,1.0,101,0.0)
+
* Select type
SELECT * FROM indexName/type
-## Features
+## SQL Features
* SQL Select
* SQL Delete
-* ES TopHits
-* ES MISSING
-* ES STATS
-* SQL COUNT distinct
-* SQL where
-* SQL AND & OR
+* SQL Where
+ * can use "case when" in where clause
* SQL Order By
+ * can use "case when" in order by clause
+* SQL Group By
+* SQL AND & OR
* SQL Like
+* SQL COUNT distinct
* SQL In
* SQL Between
* SQL Aliases
@@ -108,9 +712,42 @@ http://localhost:9200/_sql/_explain?sql=select * from indexName limit 10
* SQL sum()
* SQL Nulls
* SQL isnull()
-* SQL Group By
* SQL now()
+* SQL floor
+* SQL split
+* SQL trim
+* SQL log
+* SQL log10
+* SQL substring
+* SQL round
+ * eg: round(10.135, 2) --> 10.14
+* SQL sqrt
+* SQL concat_ws
+* SQL union and minus
+* SQL case when
+ * can use "in"、"not in" judge in case when clause
+ * can execute simple calculation in case when clause, eg : case when 1 = 1 then field_1 + field_2 else 0 end
+* SQL if
+ * select if(sex='1','男','女') from t_user;
+* SQL limit
+ * can set aggregation bucket size and shard size by setting limit, shardSize = 20 * bucketSize
+ * eg: select city,count(*) as user_count from t_user group by city limit 100;
+ * on the above example, the bucket size is 100, shard size is 20*100 = 2000
+
+
+## JDBC Support (Experimental feature)
+
+Check details : [JDBC Support](https://github.com/NLPchina/elasticsearch-sql/pull/283)
+
+## Beyond sql features
+* ES TopHits
+* ES MISSING
+* ES STATS
+* ES GEO_INTERSECTS
+* ES GEO_BOUNDING_BOX
+* ES GEO_DISTANCE
+* ES GEOHASH_GRID aggregation
diff --git a/doc/features.md b/doc/features.md
new file mode 100644
index 00000000..cb6a1c22
--- /dev/null
+++ b/doc/features.md
@@ -0,0 +1,82 @@
+## Elasticsearch-SQL
+
+[Elasticsearch-SQL](https://github.com/allwefantasy/elasticsearch-sql/) fork from [https://github.com/NLPchina/elasticsearch-sql](https://github.com/NLPchina/elasticsearch-sql)
+
+visit [interactive web](http://www.nlpcn.org:9999/web/) to feel.
+
+## features
+
+All features following require ES with groovy script enabled.
+
+* Distinct precision_threshold depends on ES or you can specify by second parameters.
+ When you have lot of shards, 40000 consume too much memory.
+* select,groupBy now support functions and field alias
+* nested function is also available,eg. `split(substring('newtype',0,3),'c')[0]`
+* Binary operation support now, eg. `floor(substring(newtype,0,14)/100)/5)*5`
+
+
+## functions support
+
+ * floor
+ * split
+ * trim
+ * log
+ * log10
+ * substring
+ * round
+ * sqrt
+ * concat_ws
+ * +
+ * -
+ * *
+ * /
+ * %
+
+## Example
+
+check Example file:
+
+```
+org.nlpcn.es4sql.Test
+```
+
+SQLs:
+
+```sql
+
+SELECT newtype as nt from twitter2
+
+SELECT sum(num) as num2,newtype as nt
+from twitter2
+group by nt order by num2
+
+SELECT sum(num_d) as num2,split(newtype,',') as nt
+from twitter2
+group by nt
+order by num2
+
+SELECT sum(num_d) as num2,floor(num) as nt
+from twitter2
+group by floor(num),newtype
+order by num2
+
+SELECT split('newtype','b')[1] as nt,sum(num_d) as num2
+from twitter2
+group by nt
+
+SELECT split(substring('newtype',0,3),'c')[0] as nt,num_d
+from twitter2
+group by nt
+
+SELECT trim(newtype) as nt
+from twitter2
+
+
+SELECT floor(floor(substring(time,0,14)/100)/5)*5 as nt,
+count(distinct(mid)) as cvalue
+FROM twitter2
+where ty='buffer' and day='20160815' and domain='baidu.com'
+group by nt
+order by cvalue
+
+```
\ No newline at end of file
diff --git a/open-source.pom.xml b/open-source.pom.xml
new file mode 100644
index 00000000..d42757f5
--- /dev/null
+++ b/open-source.pom.xml
@@ -0,0 +1,286 @@
+SQL queries
Write your SQL query and run it against elasticsearch. The results will be displayed in the table. You can use autocomple to write
your queries easier.
Enter our Wiki for more Information on how to query