如何通过Elastica使用ES插件MongoDB河将MongoDB与Elastic Search连接起来

我是编程新手,所以我很抱歉,如果我的问题非常简单。</ p>

首先,我已经使用MongoDB河安装并配置了MongoDB和ES,但我无法通过Elastica找到如何做到这一点。 我的例子是</ p>

  curl -XPUT'http:// localhost:9200 / _river / mongodb / _meta'-d'{
“type”:“mongodb”,\ n“mongodb”:{
“db”:“testTweets”,
“collection”:“msgs”
},
“index”:{
“name”:“mongoindex”,
“type “:”my_type“
}
}'
</ code> </ pre>

以及查询</ p>

  curl  -  XGET'http:// localhost:9200 / mongoindex / _search?q = something&amp; pretty = true'
</ code> </ pre>

如何使用PHP和Elastica编写它们?< / p>

我举了例子</ p>

  $ elasticaType = $ elasticaIndex-&gt; getType('tweet'); 
</ code> < / pre>

我找不到如何将curl命令与正确的php代码相匹配。</ p>

我希望能够清楚明白! 如果您需要任何其他细节来提供帮助,我将非常乐意添加它。</ p>

提前感谢您!</ p>

编辑 *** </ p>

撰写ElasticSearch分析或映射的一种不错方法是以下chrome扩展 https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo 。 这对我很有帮助。</ p>
</ div>

展开原文

原文

i'm new to programming, so i apologize, if my question is very simple.

First of all, I have installed and configured MongoDB and ES with MongoDB river, but i can't find how to do it via Elastica. My example is

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

and also a query is

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

How can i write them using PHP and Elastica?

I took as example

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

and i can't find how to match the curl command with the right php code.

I hope to be crystal clear! If you need any other to detail to give my a help, i will be very happy to add it.

Thank you in advance!

EDIT***

A nice way to compose ElasticSearch analysis or mapping is the following chrome extension https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo . It's very helpful for me.

1个回答



我相信唯一的方法就是通过PHP CURL来做.. </ p>
</ div>

展开原文

原文

I believe the only way is to do it VIA PHP CURL ..

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问