2013-02-04 10 views
3

我是編程新手,所以我很抱歉,如果我的問題很簡單。如何通過Elastica使用ES插件MongoDB連接MongoDB和Elastic Search

首先,我已經安裝並配置了MongoDB和ES與MongoDB河,但我找不到如何通過Elastica做到這一點。我的例子是

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{ 
"type": "mongodb", 
"mongodb": { 
    "db": "testTweets", 
    "collection": "msgs" 
}, 
"index": { 
    "name": "mongoindex", 
    "type": "my_type" 
} 
}' 

,也是一個查詢

curl -XGET 'http://localhost:9200/mongoindex/_search?q=something&pretty=true' 

我如何編寫使用PHP和彈性曲線呢?

我把爲例

$elasticaType = $elasticaIndex->getType('tweet'); 

,我無法找到如何使用正確的PHP代碼匹配curl命令。

我希望能夠清楚地看到!如果你需要任何其他的細節給我一個幫助,我會很樂意添加它。

預先感謝您!

EDIT ***

一個很好的辦法來組成ElasticSearch分析或映射如下鉻擴展https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo。這對我很有幫助。

回答

0

我相信唯一的辦法就是通過VIA PHP CURL ..