Named multi match query

Hello everyone , I need a hand here. I have a cross_fields multi_match query and I need to use named queries for each field. I can rewrite it into a bool/should match but then I dont know how to reproduce the cross_fields condition. Any idea? Thanks!

Multimatch query: Relevance OK, but no named queries

GET test_index/_search
{
  "query": {
    "multi_match": {
      "query": "example_query",
      "fields": ["name","lastname"],
      "type": "cross_fields"
    }
  }
}

Bool query: Named queries OK but bad relevance

GET test_index/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "name": {
              "query": "example query",
              "_name": "name_match"
            }
          }
        },
        {
          "match": {
            "latname": {
              "query": "example query",
              "_name": "latname_match"
            }
          }
        }
      ]
    }
  }
}

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