Divide Data and fire query in elasticsearch


(Devanshu Sharma) #1

HI,
I have to two index name is index1 or index2.
Both one index1 or index2 have 1000000(10 lac.) data.
I want to divide 100000(1 lac.) any one index data and apply query index1 column1 or index2 column2 both to merged and get inner join data.
query = "select * from index1 t1 inner join index2 t2 where t1.column1=t2.column2";
how can get data first time apply 1 lac. data(0-100000) then another 1lac.(100001-200000) similler to 10lac.
can you help me what can i do and please give me solution java lang.?

SearchDao searchDao = new SearchDao(esClient);
SqlElasticRequestBuilder explain = searchDao.explain(query).explain();
ElasticJoinExecutor executor = ElasticJoinExecutor.createJoinExecutor(searchDao.getClient(),explain);
executor.run();
SearchHits hits = executor.getHits();


Please give me answer
(David Pilato) #2

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.


(Devanshu Sharma) #3

I can use Joins in elasticsearch
query = "SELECT t0.,t1. FROM 265191429v5 t0 INNER JOIN 265191429v3 t1 ON ([t0.order_id] = [t1.order_id])"

code*******************
SearchDao searchDao = new SearchDao(esClient);
SqlElasticRequestBuilder explain = searchDao.explain(query).explain();
ElasticJoinExecutor executor = ElasticJoinExecutor.createJoinExecutor(searchDao.getClient(), explain);
executor.run();
SearchHits hits = executor.getHits();


But i got only 1 lac data. I want all data using inner join.
can you tell me...


(David Pilato) #4

Please format your code.

that JOINS are not supported in elasticsearch.

I can use Joins in elasticsearch

ElasticJoinExecutor is not part of elasticsearch. That's what I'm telling you. The only way to do joins officially in elasticsearch is by using this: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/parent-join.html


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.