elasticsearch elasticsearch:单个索引中有多个类型,elasticsearch,elasticsearch" /> elasticsearch elasticsearch:单个索引中有多个类型,elasticsearch,elasticsearch" />

elasticsearch elasticsearch:单个索引中有多个类型

elasticsearch elasticsearch:单个索引中有多个类型,elasticsearch,elasticsearch,我试图在一个索引中创建多个类型。例如,我试图在ytb索引中创建两种类型(host,post),以便在它们之间创建父子关系 PUT /ytb { "mappings": { "post": { "_parent": { "type": "host" }, "properties":{ "@timestamp": { "type":

我试图在一个索引中创建多个类型。例如,我试图在
ytb
索引中创建两种类型(
host
post
),以便在它们之间创建父子关系

PUT /ytb
{
  "mappings": {
      "post": {
          "_parent": {
              "type": "host" 
            },
          "properties":{
            "@timestamp": {
                  "type": "date"
              },
            "indexed": {
                  "type": "date"
              },
              "n_comments": {
                  "type": "long"
              }, 
              "n_harvested": {
                  "type": "long"
              }, 
              "n_likes": {
                  "type": "long"
              },
              "network": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              },
              "parent_id": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "post_dbid": {
                  "type": "long"
              }, 
              "post_id": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "post_netid": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "published": {
                  "type": "date"
              }
          }
      },
      "host": {
          "properties": {
              "@timestamp": {
                  "type": "date"
              }, 
              "@version": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "country": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "host_dbid": {
                  "type": "long"
              }, 
              "host_id": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "host_netid": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "id": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "indexed": {
                  "type": "date"
              }, 
              "language": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              },
              "name": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }, 
              "vertical": {
                  "fields": {
                      "keyword": {
                          "ignore_above": 256, 
                          "type": "keyword"
                      }
                  }, 
                  "type": "text"
              }
          }
      }
  }
}
但我得到了一个错误:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Rejecting mapping update to [ytb] as the final mapping would have more than 1 type: [post, host]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Rejecting mapping update to [ytb] as the final mapping would have more than 1 type: [post, host]"
  },
  "status": 400
}

更新:Elasticsearch版本:6.3.0

如果您有ES 5.6或更高版本,您需要阅读此内容。总之,映射类型将被删除,从ES 6开始,每个索引只有一种类型将成为规范


为了回答您在评论中的问题,我知道另一个类似Kibana的工具(实际上是Kibana fork),它知道如何处理连接和关系数据。它被Siren Solutions称为。另请阅读。

如果您使用的是ES 5.6或更高版本,您需要阅读以下内容:@Val非常有用,谢谢!你知道kibana是否支持新的
join数据类型吗?是否可以基于联接字段创建可视化?否,联接字段和嵌套字段都不能快速响应。请在博客帖子中发布一个答案,比如“映射类型已被删除”,以便接受它。离题:根据您的经验,您知道elasticsearch上还有其他工具可以可视化连接字段甚至连接索引吗?提前谢谢!