After doing some research on search engines, I decided to go with ElasticSearch, and was wondering what the quickest and most efficient way of implementing it with pyramid is. I've found the documentation for Pyes, but I am not sure if this is the right path to take. Thanks!
Asked
Active
Viewed 771 times
2 Answers
2
I have used elasticsearch with pyramid and the pyelasticsearch package, and it worked fine for my needs (YMMV).
Then the very simplest thing you could do would be to set up a connection in your view. Something like:
def aview(request):
myobj = ...
...
es = pyelasticsearch.ElasticSearch(request.registry.settings['es_uri'])
## index something
es.index({'a': 1}, 'aindex', 'atype', myobj.id)
...
You can of course register the connection so it is always on the request and use pyramid events to do indexing, or use a task ventilator, message queue etc...

reedobrien
- 116
- 4
0
Pyes is possible, although I prefer to simply work with raw JSON since all of the ES documentation is in JSON. Much of the mailing list posts use JSON as well, since it is more universal than the various implementations (python, java, etc).
PyCurl might work for you: http://curl.haxx.se/libcurl/python/

Zach
- 9,591
- 1
- 38
- 33