Skip to content

Join field called "_type" is duplicated in the _search results #110438

Open
@AlexeySagin

Description

@AlexeySagin

Elasticsearch Version

8.14.1

Installed Plugins

No response

Java Version

bundled

OS Version

Linux 5.19.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.19.11-1 (2022-09-24) x86_64 GNU/Linux

Problem Description

If join field called _type it's duplicated in _search request results.
Problem appears at 8.14 release.
8.9; 8.12; 8.13 is ok.

Steps to Reproduce

  1. make index and docs as example in documentation for join field type:
    https://www.elastic.co/guide/en/elasticsearch/reference/8.14/parent-join.html

  2. make search curl 'localhost:9200/my-index-000001/_search?pretty'
    got resutl like:

{
     "_index" : "my-index-000001",
     "_id" : "4",
     "_score" : 1.0,
     "_routing" : "1",
     "_source" : {
       "my_id" : "4",
       "text" : "This is another answer",
       "my_join_field" : {
         "name" : "answer",
         "parent" : "1"
       }
     }
   }
  1. reproduce steps 1 and 2, but rename index name from my-index-000001 to my-index-000002 and join field my_join_field to _type

  2. make search curl 'localhost:9200/my-index-000002/_search?pretty'

{
        "_index" : "my-index-000002",
        "_id" : "4",
        "_score" : 1.0,
        "_routing" : "1",
        "_type" : {
          "name" : "answer",
          "parent" : "1"
        },
        "_source" : {
          "my_id" : "4",
          "text" : "This is another answer",
          "_type" : {
            "name" : "answer",
            "parent" : "1"
          }
        }
      }

result: _type field is duplicated inside and outside _source
expected: _type field present only inside _source

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions