user2196474
user2196474

Reputation: 319

Add new field to existing nested

I have my index mapping with nested:

I want to add new field 'organization' to my nested 'subject'. How should I do it through Kibana?

{
"index_test": {
"mappings": {
"search_type": {
"properties": {
"person": {
"properties": {
"relation": {
"properties": {
"subject": {
"type": "nested",
"properties": {
"firstName": {
"type": "keyword",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
} } },
"lastName": {
"type": "keyword",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
} } } } } } } } } }} } }

Upvotes: 0

Views: 241

Answers (1)

Val
Val

Reputation: 217284

Simply add the new sub-field like this:

PUT index_test/_mapping/search_type
{
  "properties": {
    "person": {
      "properties": {
        "relation": {
          "properties": {
            "subject": {
              "type": "nested",
              "properties": {
                "organization": {
                  "type": "keyword",
                  "fields": {
                    "english": {
                      "type": "text",
                      "analyzer": "english"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Upvotes: 1

Related Questions