我在Windows上使用elasticsearch 2.3.3
,
安装elasticsearch
之后
elasticsearch-analysis-ik
,
我尝试了elasticsearch-analysis-ik
,https://github.com/medcl/elasticsearch-analysis-ik的文档中的示例,如下所示:
1,创建索引,没关系。
$ curl -XPUT http://localhost:9200/index
{"acknowledged":true}
2,创建一个映射,没关系。
$ 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.索引一些文档。这里出错,如下:
$ 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}