Joining queries across types and indexes

Hi All,

I have store customer, agent and customeragentmap as below,
curl -XPUT "http://localhost:9200/my_index/customer/1?pretty" -d "{ "firstname" : "deepan", "lastname" : "chandra", "customerid" : "c1"}"
curl -XPUT "http://localhost:9200/my_index/customer/2?pretty" -d "{ "firstname" : "siva", "lastname" : "suresh", "customerid" : "c2"}"
curl -XPUT "http://localhost:9200/my_index/customer/3?pretty" -d "{ "firstname" : "vaira", "lastname" : "muthu", "customerid" : "c3"}"
curl -XPUT "http://localhost:9200/my_index/customer/4?pretty" -d "{ "firstname" : "balaji", "lastname" : "badraraju", "customerid" : "c4"}"
curl -XPUT "http://localhost:9200/my_index/customer/5?pretty" -d "{ "firstname" : "deva", "lastname" : "subramani", "customerid" : "c5"}"
curl -XPUT "http://localhost:9200/my_index/agent/1?pretty" -d "{ "agentname" : "arun", "agentid" : "a2"}"
curl -XPUT "http://localhost:9200/my_index/agent/2?pretty" -d "{ "agentname" : "vanitha", "agentid" : "a4"}"
curl -XPUT "http://localhost:9200/my_index/agent/3?pretty" -d "{ "agentname" : "kisshor", "agentid" : "a6"}"
curl -XPUT "http://localhost:9200/my_index/agent/4?pretty" -d "{ "agentname" : "balaji", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/1?pretty" -d "{ "customerid" : "c2", "agentid" : "a2"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/2?pretty" -d "{ "customerid" : "c4", "agentid" : "a2"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/3?pretty" -d "{ "customerid" : "c1", "agentid" : "a4"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/4?pretty" -d "{ "customerid" : "c2", "agentid" : "a4"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/5?pretty" -d "{ "customerid" : "c3", "agentid" : "a4"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/6?pretty" -d "{ "customerid" : "c3", "agentid" : "a6"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/7?pretty" -d "{ "customerid" : "c1", "agentid" : "a6"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/8?pretty" -d "{ "customerid" : "c5", "agentid" : "a6"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/9?pretty" -d "{ "customerid" : "c2", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/10?pretty" -d "{ "customerid" : "c1", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/11?pretty" -d "{ "customerid" : "c4", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/12?pretty" -d "{ "customerid" : "c5", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/13?pretty" -d "{ "customerid" : "c3", "agentid" : "a8"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/14?pretty" -d "{ "customerid" : "c4", "agentid" : "a4"}"
curl -XPUT "http://localhost:9200/my_index/agentcutomermap/18?pretty" -d "{ "customerid" : "c5", "agentid" : "a2"}"

Can anyone tell me how I write a query to fetch all customerid records from corresponding agentid and vise versa. The work around can be any way.

I want to take only customer records from having agentid

Are you trying to do this in Kibana? If you're looking for general advice on how to query elasticsearch I suggest the #elasticsearch category

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