Failed to create filtered alias with terms lookup

Hello,

I have run into exactly the same problem reported in this closed topic: Terms lookup in a filtered alias. Since it's not been answered, I am posting it again.

Much appreciated in advance if someone could confirm this is unexpected behaviour, should be reported as a bug.

Best regards
Junjun

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Hi David,

Thanks for the quick response. Here are steps to reproduce the problem in Kibana (version 7.6.1):

PUT /colors/_doc/1
{
  "color":   ["red", "green"]
}

PUT /colors/_doc/2
{
  "color":   "blue"
}

PUT /products/_doc/1
{
  "id": "a",
  "color": "red"
}

PUT /products/_doc/2
{
  "id": "b",
  "color": "blue"
}

POST /_aliases
{
  "actions": [
    {
      "add": {
        "index": "products",
        "alias": "color2_products",
        "filter": {
          "terms": {
            "color": {
              "index": "colors",
              "id": "2",
              "path": "color"
            }
          }
        }
      }
    }
  ]
}

The last step of creating alias fails with the following response while same operation (with type added) works fine in version 5.6.9

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "failed to parse filter for alias [color2_products]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "failed to parse filter for alias [color2_products]",
    "caused_by" : {
      "type" : "illegal_state_exception",
      "reason" : "async actions are left after rewrite"
    }
  },
  "status" : 400
}

However, the following terms lookup query works as expected:

GET /products/_search
{
  "query": {
    "terms": {
        "color" : {
            "index" : "colors",
            "id" : "2",
            "path" : "color"
        }
    }
  }
}

Thanks,
Junjun

Just filed an issue on github: https://github.com/elastic/elasticsearch/issues/54550

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