测试standard的时候报出编码错误的问题

来源:5-4 通过_analyze分析分词器standard和ik的区别

风中沙

2018-06-26

{

"error": {

"root_cause": [{

"type": "illegal_argument_exception",

"reason": "Failed to parse request body"

}],

"type": "illegal_argument_exception",

"reason": "Failed to parse request body",

"caused_by": {

"type": "json_parse_exception",

"reason": "Invalid UTF-8 start byte 0xbf\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@103384d2; line: 1, column: 3]"

}

},

"status": 400

}

在测试ik和standard的区别的时候,输入:

curl -X POST "http://127.0.0.1:9200/_analyze?analyzer=standard" -H 'Content-Type: application/json' -d '这是一个商品的标题'

就弹出了这个问题。我查了一下mac终端的编码是zh_CN.UTF-8,然后

执行 curl "http://127.0.0.1:9200"也是正常的,

{

  "name" : "master-1",

  "cluster_name" : "yii2-search",

  "cluster_uuid" : "lScxXNO6R7i-c21-uxChLg",

  "version" : {

    "number" : "6.3.0",

    "build_flavor" : "default",

    "build_type" : "zip",

    "build_hash" : "424e937",

    "build_date" : "2018-06-11T23:38:03.357887Z",

    "build_snapshot" : false,

    "lucene_version" : "7.3.1",

    "minimum_wire_compatibility_version" : "5.6.0",

    "minimum_index_compatibility_version" : "5.0.0"

  },

  "tagline" : "You Know, for Search"

}

不知道还有什么地方遗漏了,麻烦老师帮我看一下,谢谢!

写回答

1回答

Jason

2018-07-02

嗯,这个是编码的问题,改成unicode试试

0
1
风中沙
非常感谢!
2018-07-09
共1条回复

Yii2.0进阶版 高级组件ES/Redis/Sentry优化京东平台

进阶更高阶的Yii 2.0开发,获得2-3年yii 2.0实战经验

514 学习 · 210 问题

查看课程