Pass result from first query to another one

GET logstash-2017.08.14/gateway_logs/_search
{
"query": {
"bool": {
"must": {
"match": { "status": "logged in"}
}
}
}
}

The output is that:

{
"_index": "logstash-2017.08.14",
"_type": "gateway_logs",
"_id": "AV3fVGuWRMNtmvyiarbS",
"_score": 0.73761284,
"_source": {
"@timestamp": "2017-08-14T06:00:38.031Z",
"login_type": "Twitter",
"@version": "1",
"type": "gateway_logs",
"stationIpAddress": "10.102.249.146",
"tags": [
"Success"
],
"status": "logged in"
}
},

I need to pass the value of stationIpAddress in the second query

GET logstash-2017.08.14/xms_api_station_info/_search
{
"query": {
"bool": {
"filter": {
"term": { "stationIpAddress": "i need to pass the value from result here"}
}
}
}
}

Thanks,

Elasticsearch won't do that for you. You need to handle this externally. Maybe using a script or in an application.

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