Divide Data and fire query in elasticsearch

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

It might be better to ask the author of this plugin: https://github.com/NLPchina/elasticsearch-sql (sounds like you are using that).

Note that JOINS are not supported in elasticsearch.