向现有嵌套添加新字段

时间:2019-05-15 07:37:11

标签: elasticsearch

我有嵌套的索引映射:

我想向嵌套的“主题”添加新字段“组织”。我应该如何通过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"
} } } } } } } } } }} } }

1 个答案:

答案 0 :(得分:1)

只需添加新的子字段,如下所示:

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