Correlating field values between mappings in search

Hi,

Basically what i want to do is having a field "ID" in mapping "A", and having a list of values in field "IDS" in mapping "B", i want to get the documents or count the ones that match, just like an IN() clause in other query languages. Reading the docs, i found that groovy scripting may be the answer, but i've tried doing queries without any results, this is my attempt:

{
"query":{
"filtered": {
"query": {"query_string":{"query":"(_type: mapping_a) AND (_type: mapping_b)"}},
"filter": {
"script": {
"script": "doc['id'].value == doc['ids'].value"
}
}
}
}
}

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