2016-04-07 30 views
2

對於我的研究,我應該將俄文維基百科的轉儲導入Elasticsearch 2.2。但是,我決定使用Wikimedia(http://dumps.wikimedia.org/other/cirrussearch/)發佈的索引來代替導入轉儲。爲了使用它,我找到了一篇文章https://www.elastic.co/blog/loading-wikipedia,並嘗試使用作者的腳本來解決我的問題(只是替換了一些導出語句)。但是,有一個在步驟2將維基百科的索引導入Elasticsearch

的一個問題,是我的版本的腳本步驟2:

export es=localhost:9200 
export site=ru.wikipedia.org 
export index=ruwiki 

curl -XDELETE $es/$index?pretty 

curl -s 'https://'$site'/w/api.php?action=cirrus-settings-dump&format=json&formatversion=2' | 
jq '{ analysis: .content.page.index.analysis, number_of_shards: 1, number_of_replicas: 0 }' | 
curl -XPUT $es/$index?pretty -d @- 

curl -s 'https://'$site'/w/api.php?action=cirrus-mapping-dump&format=json&formatversion=2' | 
jq .content | 
sed 's/"index_analyzer"/"analyzer"/' | 
sed 's/"position_offset_gap"/"position_increment_gap"/' | 
curl -XPUT $es/$index/_mapping/page?pretty -d @- 

而結果

{ 
    "acknowledged" : true 
} 
{ 
    "acknowledged" : true 
} 
{ 
    "error" : { 
    "root_cause" : [ { 
     "type" : "action_request_validation_exception", 
     "reason" : "Validation Failed: 1: mapping source is empty;" 
    } ], 
    "type" : "action_request_validation_exception", 
    "reason" : "Validation Failed: 1: mapping source is empty;" 
    }, 
    "status" : 400 
} 

我也試過只使用筆者的腳本測試。有同樣的錯誤。我不知道該怎麼辦。請幫助解決它。

回答

1

維基百科轉儲目前從ElasticSearch 1.7.5導出。很可能(我沒有測試過)當前的映射與ES 2.2不兼容。嘗試使用舊版本的ES可能是值得的。

編輯:最新的轉儲現在兼容elasticsearch 2.x