Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a MongoDB as my main DB and I request my data my pymongo for my Django project.

I learnt about Elasticsearch recently and I want to use it to get data from my MongoDB. I found the recent Python client for Elasticsearch but reading the few information around the internet I mostly found shell commands like this one.

In python I originally connected to my MongoDB and then make a query:

db.col.find({   'latitude' : {'$gt' : south, '$lt' :north }
                'display': True,
                'description' : {'$regex' : '/adventure/'} //the regex might not be correct but doesn't matter
            }

I want to use Elasticsearch to replace the regex with a more optimal text search engine.


So my questions are on how can I perform an Elasticsearch to my MongoDB.

  • How do I connect to Elasticsearch to my MongoDB (on python) assuming that my URI is : mongo://localhost:27017

  • How do I query MongoDB with Elasticsearch and return the JSON results in python.

From what I understand:

I have to connect from python to elasticsearch, then have elasticsearch connected to mongodb to index it and then query elasticsearch from python to get the data? Or just the indexes?

PS: I tried to search tuts for python,mongodb and elasticsearch but if you know any it would be welcome.

Thank you.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.