Search using result of previous search as parameter

Hi,

I need a help please, I have searched many topics and didn't find the answer.

I need to pass result of search as parameters like in SQL : SELECT * FROM Table Where Field_1 = (SELECT Field_1 FROM Table WHERE Field_2 = 'searched_data')

Here is my search in elasticsearch.

 GET _search
  {
  "query": {
    "query_string": {
    "default_field": "msgbody",
     "query": "searched_data"
   }
 },
 "_source": ["thread_name"],
 "size" : 1
}

I tried to pass in params but didn't find the right way:

 GET _search/template
 {
   "source" : {
    "query": { 
    "match_phrase" : { "{{my_field}}" : "{{my_value}}" }
     }
   },
 "params" : {
  "my_field" : "thread_name",
  "my_value" : "my_search_results"
  }
}

So my question is it possible to get result like SQL?

In case that's not possible, do you have any suggestion to get simular result?

Best Regards

Khalil CHARFI

Up please any response will help me.

Thank you.

Please read

Specifically the "be patient" part.

You can't do that automatically so you need to solve that on your side (client side).
You will end up doing multiple calls.

Thank you for your Help.

I know this is hard to answer every one.

I will be patient.

Best Regards

Khalil CHARFI

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