elasticsearch 如何将这些映射更改为具有嵌套字段?
我有以下映射,但我不确定如何更改它,以便ESK知道单个包类别是一个嵌套字段elasticsearch 如何将这些映射更改为具有嵌套字段?,elasticsearch,kibana,elasticsearch,Kibana,我有以下映射,但我不确定如何更改它,以便ESK知道单个包类别是一个嵌套字段 PUT /durationsmapping/_mapping { "mappings" : { "properties" : { "individual-package-categories" : { "properties" : { "activity" : { "type": "nested"
PUT /durationsmapping/_mapping
{
"mappings" : {
"properties" : {
"individual-package-categories" : {
"properties" : {
"activity" : {
"type": "nested"
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"duration" : {
"type" : "long"
},
"time-set" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
}
弹性>=7.x的
放置/持续时间映射
{
“映射”:{
“财产”:{
“个别包裹类别”:{
“类型”:“嵌套”,
“财产”:{
“活动”:{
“类型”:“文本”,
“字段”:{
“关键字”:{
“类型”:“关键字”,
“忽略上面的内容”:256
}
}
},
“期限”:{
“类型”:“长”
},
“时间设置”:{
“类型”:“文本”,
“字段”:{
“关键字”:{
“类型”:“关键字”,
“忽略上面的内容”:256
}
}
}
}
}
}
}
}
对于弹性<7.x
放置/持续时间映射
{
“映射”:{
“_doc”:{
“财产”:{
“个别包裹类别”:{
“类型”:“嵌套”,
“财产”:{
“活动”:{
“类型”:“文本”,
“字段”:{
“关键字”:{
“类型”:“关键字”,
“忽略上面的内容”:256
}
}
},
“期限”:{
“类型”:“长”
},
“时间设置”:{
“类型”:“文本”,
“字段”:{
“关键字”:{
“类型”:“关键字”,
“忽略上面的内容”:256
}
}
}
}
}
}
}
}
}
我以前尝试过,但它给了我以下错误:“错误”:{“根原因”:[{“类型”:“映射器解析异常”,“原因”:“根映射定义有不受支持的参数:[映射:{properties={individual package categories={type=nested,properties={duration={type=long},activity={type=text,fields]={keyword={ignore\u over=256,type=keyword}}},time set={type=text,fields={keyword={ignore\u over=256,type=keyword}}}]“是的,我更新了我的答案。请注意,如果您使用的是{u-mappings端点,您不需要指定“mappings”在文档正文中。我明白了!非常感谢!当我尝试访问嵌套数据时,我可以在“发现”选项卡中看到它,但无法在可视化中访问它。
For Elastic >= 7.x
PUT /durationsmapping
{
"mappings" : {
"properties" : {
"individual-package-categories" : {
"type": "nested",
"properties" : {
"activity" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"duration" : {
"type" : "long"
},
"time-set" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
}
For Elastic < 7.x
PUT /durationsmapping
{
"mappings" : {
"_doc": {
"properties" : {
"individual-package-categories" : {
"type": "nested",
"properties" : {
"activity" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"duration" : {
"type" : "long"
},
"time-set" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
}
}