Update partial fields leads to other fields missing that are excluded in the _source

For example, i have a mapping as followed:

     {
       "mappings": {
          "_source": {
               "includes": [
                 "gender"
               ]
          },
          "properties": {
             "name": {
                "type": "keyword"
             },
             "gender": {
                "type": "keyword"
             }
          }
     }
 }

After i put a document into the index, if i update this document with

POST myindex/_doc/1/_update
    {
        "doc":{
            "gender":"male"
        }
    }

i will lose the name field forever. Because the name field is not included in the _source.
I understand that every update operation is a brand new reindex, es will take the whole _source out of the document and execute the index operation again even just update one or two fields out of 100. Under this circumstance, i have to gather all the fields that are excluded in the _source to make an update-one-field operation.
The reason why i exclude these fields is that i want to make the index as small as possible. We fetch the fields through docvalue_fields and disable the whole _source, in this case, our index is fast and small.
So what's your suggestion if we want to do the update partial fields and leave the whole source disabled?

I don't think it's possible. And IMHO you should always keep the _source intact.

1 Like

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