繁体   English   中英

如何创建类型为“ Array”的字段的映射?

[英]How to create mapping of a field of type `Array`?

我想在elasticsearch创建一个索引,其中文档的字段为array Elasticsearch提供错误-'reason 'reason': 'No type specified for field <field_name>'

我给像- "field_name": {"store": "false"} 我希望此字段的类型为字符串数组。 但Elasticsearch不支持数组类型- https://www.elastic.co/guide/en/elasticsearch/reference/6.4/array.html

错误消息非常清楚:

没有为字段field_name指定类型

您只需要定义数组中包含的数据类型。

"field_name": {
   "type": "text",          <--- add this
   "store": "false"
}

然后您可以索引一个字符串数组

{
   "field_name": ["one", "two", "three"]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM