_update Object filed with json or flattened

hello~

I have an index with mapping like this:

"test" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "out" : {
          "properties" : {
            "in" : {
              "type" : "keyword"
            }
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "1",
        "provided_name" : "test",
        "creation_date" : "1661920435052",
        "number_of_replicas" : "1",
        "uuid" : "4mUZUDWrTlWUaoTYO5aOwg",
        "version" : {
          "created" : "8040099"
        }
      }
    }
  }
}

I will receive some update request like:

POST test/${id}/_update
{
     "doc": {
            "out.in":"version_3"
      }
}

or 

POST test/${id}/_update
{
    "doc":{
        "out":{
              "in":"version_2"
         }
    }
}

But I found that both of the value is stored:

GET test/_search 
{"docvalue_fields":["out.in"]}


{
  "took" : 6,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "test",
        "_id" : "O7su8oIBJoXy7FN7B6HS",
        "_score" : 1.0,
        "_source" : {
          "out" : {
            "in" : "version_2"
          },
          "out.in" : "version_3"
        },
        "fields" : {
          "out.in" : [
            "version_2",
            "version_3"
          ]
        }
      }
    ]
  }
}

Is this as expected? I think both "out.in" and "out:{"in":}" are same filed.

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