如何在 kibana 的索引中正确嵌套映射?
how to properly nest mappings in an index in kibana?
我正在尝试创建一个具有嵌套映射的索引,但我不确定 json 数据应该是什么样子。我正在使用 kibana 版本 v 7.4.2。下面的示例有效,但是如果当我尝试添加任何嵌套映射(示例 2)时,我在最后出现错误。
示例 1
PUT testIndex?pretty=true
{
"mappings":{
"_doc":{
"properties":{
"time":{
"type":"date",
"format":"HH:mm:ss"
}
}
}
}
}
示例 2
PUT testIndex?pretty=true
{
"mappings":{
"_doc":{
"properties":{
"time":{
"type":"date",
"format":"HH:mm:ss"
}
},
"predicted":{
"type":"nested",
"properties":{
"numofreq":{
"type":"integer"
}
}
}
}
}
}
错误
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
}
],
"type": "illegal_argument_exception",
"reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
},
"status": 400
}
在较新版本的 elasticsearch 中已弃用指定 _doc 类型
这应该有效
样本 1
PUT testindex?pretty=true
{
"mappings": {
"properties": {
"time": {
"type": "date",
"format": "HH:mm:ss"
}
}
}
}
示例 2
PUT testindex1?pretty=true
{
"mappings": {
"properties": {
"time": {
"type": "date",
"format": "HH:mm:ss"
},
"predicted": {
"type": "nested",
"properties": {
"numofreq": {
"type": "integer"
}
}
}
}
}
}
我正在尝试创建一个具有嵌套映射的索引,但我不确定 json 数据应该是什么样子。我正在使用 kibana 版本 v 7.4.2。下面的示例有效,但是如果当我尝试添加任何嵌套映射(示例 2)时,我在最后出现错误。
示例 1
PUT testIndex?pretty=true
{
"mappings":{
"_doc":{
"properties":{
"time":{
"type":"date",
"format":"HH:mm:ss"
}
}
}
}
}
示例 2
PUT testIndex?pretty=true
{
"mappings":{
"_doc":{
"properties":{
"time":{
"type":"date",
"format":"HH:mm:ss"
}
},
"predicted":{
"type":"nested",
"properties":{
"numofreq":{
"type":"integer"
}
}
}
}
}
}
错误
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
}
],
"type": "illegal_argument_exception",
"reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
},
"status": 400
}
在较新版本的 elasticsearch 中已弃用指定 _doc 类型
这应该有效
样本 1
PUT testindex?pretty=true
{
"mappings": {
"properties": {
"time": {
"type": "date",
"format": "HH:mm:ss"
}
}
}
}
示例 2
PUT testindex1?pretty=true
{
"mappings": {
"properties": {
"time": {
"type": "date",
"format": "HH:mm:ss"
},
"predicted": {
"type": "nested",
"properties": {
"numofreq": {
"type": "integer"
}
}
}
}
}
}