首页 > 使用elasticsearch时failed to parse是什么原因?

使用elasticsearch时failed to parse是什么原因?

在windows上试用一下elasticsearch,安装完elasticsearch和中文分词elasticsearch-analysis-ik后,按照文档https://github.com/medcl/elasticsearch-analysis-ik 的示例进行操作,
1、create a index 这一步没有问题

curl -XPUT http://localhost:9200/index 
{"acknowledged":true}

2、create a mapping 这一步也没有问题

$ curl -XPOST http://localhost:9200/index/fulltext/_mapping -d'
> {
>     "fulltext": {
>              "_all": {
>             "analyzer": "ik_max_word",
>             "search_analyzer": "ik_max_word",
>             "term_vector": "no",
>             "store": "false"
>         },
>         "properties": {
>             "content": {
>                 "type": "string",
>                 "store": "no",
>                 "term_vector": "with_positions_offsets",
>                 "analyzer": "ik_max_word",
>                 "search_analyzer": "ik_max_word",
>                 "include_in_all": "true",
>                 "boost": 8
>             }
>         }
>     }
> }'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   587  100    21  100   566    677  18258 --:--:-- --:--:-- --:--:-- 18258{"                                                                                   acknowledged":true}

3.index some docs 这一步问题来了,“failed to parse”,不知什么意思和原因,请大神帮看看。

$ curl -XPOST http://localhost:9200/index/fulltext/1 -d'
> {"content":"美国留给伊拉克的是个烂摊子吗"}
> '
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   416  100   372  100    44   4769    564 --:--:-- --:--:-- --:--:--  5904{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [content]"}],"type":"mapper_parsing_exception","reason":"failed to parse [content]","caused_by":{"type":"json_parse_exception","reason":"Invalid UTF-8 middle byte 0xc0\n at [Source: org.elasticsearch.common.io.stream.InputStreamStreamInput@324c601f; line: 2, column: 15]"}},"status":400}

【热门文章】
【热门文章】