Issue Using project Field in _msearch with Siren Federate

Hi,
I’m using the Siren Federate plugin and encountering an issue with multi-search (_msearch) queries.

When I use a regular _search query, I can project fields without any problems. However, when I use the same query in _msearch, I get the following error:

{ "index": "user" }
{ "size": 0, "track_total_hits": true, "query": {  "bool":  {  "filter":  [  {  "bool":  {  "must":  [  {  "query_string":  {  "query":  "_exists_:link"  }  }  ]  }  },  {  "bool":  {  "must":  [  {  "join":  {  "indices":  [  "user_info"  ],  "on":  [  "id",  "id"  ],  "request":  {  "query":  {  "bool":  { "must_not":  [  {  "ids":  {  "values":  [  "123"  ]  }  }  ]  }  },  "project":  [  {  "field":  {  "name":  "_score",  "alias":  "sub_score"  }  }  ]  }  }  }  ]  }  }  ],  "must":  [  {  "function_score":  {  "functions":  [  {  "field_value_factor":  {  "field":  "sub_score",  "factor":  1,  "missing":  1  }  }  ]  }  }  ]  }  } }
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Unknown key for a START_ARRAY in [project].",
        "line": 824,
        "col": 52
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[824:52] [bool] failed to parse field [filter]",
    "caused_by": {
      "type": "x_content_parse_exception",
      "reason": "[824:52] [bool] failed to parse field [must]",
      "caused_by": {
        "type": "parsing_exception",
        "reason": "Unknown key for a START_ARRAY in [project].",
        "line": 824,
        "col": 52
      }
    }
  },
  "status": 400
}

I wanted to ask if projection in _msearch requires a special structure or has any limitations, or if this might be an issue with the Siren Federate plugin itself.

Any guidance or example queries would be greatly appreciated.

Hello,

There is indeed a bug with msearch. Until the fix is there, just wrap the project into an ext yourself. See edited request:

{"index":"user"}
{"size":0,"track_total_hits":true,"query":{"bool":{"filter":[{"bool":{"must":[{"query_string":{"query":"_exists_:link"}}]}},{"bool":{"must":[{"join":{"indices":["user_info"],"on":["id","id"],"request":{"query":{"bool":{"must_not":[{"ids":{"values":["123"]}}]}},"ext":{"project":[{"field":{"name":"_score","alias":"sub_score"}}]}}}}]}}],"must":[{"function_score":{"functions":[{"field_value_factor":{"field":"sub_score","factor":1,"missing":1}}]}}]}}}

Thanks for bringing this to our attention!

1 Like

Hi again, dear friend!
It worked
I can’t tell you how helpful this was. I really, really appreciate it.

1 Like

A fix is available in the 39 release Downloads - SIREN of Federate