2017-01-01 55 views
0

當我嘗試使用ES網站進行演示時:https://www.elastic.co/guide/en/elasticsearch/reference/current/_testing_analyzers.html - 自定義分析器的最新示例。這個例子不起作用。即使在這個例子中,我也沒有改變任何東西。我認爲它Elasticsearch錯誤。有誰能夠幫助我?下面我顯示在ubuntu終端中顯示我Elastichsearch的命令和錯誤。 當我嘗試在elasticsearch-php中創建這個示例時,發生同樣的錯誤。Elasticsearch v5分析器演示示例不起作用

首先,我創建分析儀,因爲他的例子所示:

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.對不起,我的英語不好。

回答

1

您的GET請求不正確。不應該有「_analyze」之間的空間「?漂亮」,讓你的捲髮應

curl -XGET 'localhost:9200/my_index/_analyze?pretty' -d' 

隨後查詢。

+0

謝謝@ ravi-naik!它的工作!這意味着演示有語法錯誤,因爲當我通過「COPY AS CURL」複製時,所有內容都被複制到錯誤的空間中。 –

+0

正確,我[提出問題](https://github.com/elastic/docs/issues/139),讓我們看看是否得到解決。 – Val