2013-02-04 9 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 ..