---
title: "elasticsearch7.3报错[script] unknown field
date: 2019-08-31 08:01:50
categories: 全文检索
tags:
- post
- 文件
- file
- 脚本
- elasticsearch
- script
- unknow
---
elasticsearch7.3报错[script] unknown field
, parser not found原因:高版本的elasticsearch不支持file类型,也就是说不支持从外部文件读取脚本。
解决方法:
1.需要先将脚本post到es的库中
POST _scripts/caculate-price
{
"script":{
"lang":"painless",
"source": "ctx._source.price += params.new_price"
}
}
2.根据id来调用
POST test_index/product/1/_update
{
"script":{
"id":"caculate-price",
"params": {
"new_price": 22
}
}
}