Skip to content

Field API fails with _id being an alias #75836

@timroes

Description

@timroes

Steps to reproduce:

  1. Create the following index with the appropriate index mapping:
PUT /my-index-000001
{
  "mappings": {
    "properties": {
      "@timestamp":    { "type": "date" },  
      "pseudonym":   { "type": "alias", "path": "_id"  }
    }
  }
}
  1. Create the following document:
POST my-index-000001/_doc/
{
  "@timestamp": "2021-07-29T13:13:00",
  "message": "GET /search HTTP/1.1 200 1070000",
  "user": {
    "id": "kimchy"
  }
}
  1. Query now for all fields:
GET my-index-000001/_search
{
  "fields": [ "*" ]
}

The last query will now fail with the following exception:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "unsupported_operation_exception",
        "reason" : "unsupported_operation_exception: Cannot fetch values for internal field [_id]."
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "field-alias-test",
        "node" : "VBJ2JqanRZG4IwpqrPS-WA",
        "reason" : {
          "type" : "unsupported_operation_exception",
          "reason" : "unsupported_operation_exception: Cannot fetch values for internal field [_id]."
        }
      }
    ]
  },
  "status" : 500
}

Expected behavior: This request should not fail, but return all fields correctly.

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions