You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

导入JSON至Elasticsearch遇错误:创建索引存在未知键[mapping]

解决Elasticsearch创建索引时的parse_exception错误

错误原因很明确:请求体里的键名使用了单数的mapping,而Elasticsearch要求创建索引时用复数的mappings,因此触发parse_exception并返回400状态码。

修正后的curl命令如下:

curl -XPUT localhost:9200/movies -d'
{
    "mappings": {
            "properties": {
                    "year": {
                            "type": "date"
                    }
            }
    }
}'

注:Elasticsearch 7.x及以上版本无需指定文档类型,直接在mappings下定义字段属性即可,上述命令适配该版本规范。

内容的提问来源于stack exchange,提问作者KARAN SHIRPURKAR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 19:09:28