Elasticsearch v5 分析器演示示例不工作
Elasticsearch v5 analyzer demo example not working
当我尝试使用 ES 网站进行演示时:https://www.elastic.co/guide/en/elasticsearch/reference/current/_testing_analyzers.html
- 自定义分析器的最新示例。这个例子不起作用。即使在示例中,我也没有更改任何内容。我认为是 Elasticsearch 错误。有谁能够帮助我?下面我展示了在 ubuntu 终端中向我展示 Elastichsearch 的命令和错误。
当我尝试在 elasticsearch-php.
中制作这个例子时,同样的错误发生了
首先,我创建分析器,如示例所示:
curl -XPUT 'localhost:9200/my_index?pretty' -d'
> {
> "settings": {
> "analysis": {
> "analyzer": {
> "std_folded": {
> "type": "custom",
> "tokenizer": "standard",
> "filter": [
> "lowercase",
> "asciifolding"
> ]
> }
> }
> }
> },
> "mappings": {
> "my_type": {
> "properties": {
> "my_text": {
> "type": "text",
> "analyzer": "std_folded"
> }
> }
> }
> }
> }'
{
"acknowledged" : true,
"shards_acknowledged" : true
}
很好,分析器已创建。但是测试示例不起作用:
curl -XGET 'localhost:9200/my_index/_analyze ?pretty' -d'
> {
> "analyzer": "std_folded",
> "text": "Is this déjà vu?"
> }'
然后 ES 回答我:
{
"error":
{"root_cause":
[{
"type":"index_not_found_exception",
"reason":"no such index",
"resource.type":"index_or_alias",
"resource.id":"bad-request",
"index_uuid":"_na_",
"index":"bad-request"
}],
"type":"index_not_found_exception",
"reason":"no such index",
"resource.type":"index_or_alias",
"resource.id":"bad-request",
"index_uuid":"_na_",
"index":"bad-request"},
"status":404
}
我做错了什么?我删除了所有索引并重新创建,我尝试重新启动 elasticsearch - 但无济于事。
P.S。请原谅我的英语不好。
您的 GET 请求不正确。 '_analyze' 和 '?pretty' 之间不应该有 space,所以你的卷曲应该是
curl -XGET 'localhost:9200/my_index/_analyze?pretty' -d'
后面是查询。
当我尝试使用 ES 网站进行演示时:https://www.elastic.co/guide/en/elasticsearch/reference/current/_testing_analyzers.html - 自定义分析器的最新示例。这个例子不起作用。即使在示例中,我也没有更改任何内容。我认为是 Elasticsearch 错误。有谁能够帮助我?下面我展示了在 ubuntu 终端中向我展示 Elastichsearch 的命令和错误。 当我尝试在 elasticsearch-php.
中制作这个例子时,同样的错误发生了首先,我创建分析器,如示例所示:
curl -XPUT 'localhost:9200/my_index?pretty' -d'
> {
> "settings": {
> "analysis": {
> "analyzer": {
> "std_folded": {
> "type": "custom",
> "tokenizer": "standard",
> "filter": [
> "lowercase",
> "asciifolding"
> ]
> }
> }
> }
> },
> "mappings": {
> "my_type": {
> "properties": {
> "my_text": {
> "type": "text",
> "analyzer": "std_folded"
> }
> }
> }
> }
> }'
{
"acknowledged" : true,
"shards_acknowledged" : true
}
很好,分析器已创建。但是测试示例不起作用:
curl -XGET 'localhost:9200/my_index/_analyze ?pretty' -d'
> {
> "analyzer": "std_folded",
> "text": "Is this déjà vu?"
> }'
然后 ES 回答我:
{
"error":
{"root_cause":
[{
"type":"index_not_found_exception",
"reason":"no such index",
"resource.type":"index_or_alias",
"resource.id":"bad-request",
"index_uuid":"_na_",
"index":"bad-request"
}],
"type":"index_not_found_exception",
"reason":"no such index",
"resource.type":"index_or_alias",
"resource.id":"bad-request",
"index_uuid":"_na_",
"index":"bad-request"},
"status":404
}
我做错了什么?我删除了所有索引并重新创建,我尝试重新启动 elasticsearch - 但无济于事。 P.S。请原谅我的英语不好。
您的 GET 请求不正确。 '_analyze' 和 '?pretty' 之间不应该有 space,所以你的卷曲应该是
curl -XGET 'localhost:9200/my_index/_analyze?pretty' -d'
后面是查询。