How to connect MongoDB with Elastic Search using ES MongoDB river plugin via Elastica

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 cannot find how to do this via Elastica. My example

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

      

and also request

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

      

How can I write them using PHP and Elastica?

As an example, I gave

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

      

and I cannot find how to combine curl command with correct PHP code.

I hope this is clear! If you need any other information to help me, I'll be very happy to add it.

Thank you in advance!

EDIT ***

The following chrome extension https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo is a good way to compose an ElasticSearch analysis or comparison . This is very helpful for me.

+3


source to share


1 answer


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



0


source







All Articles