BenDundee
BenDundee

Reputation: 4521

Elastic search client for Python: advice?

I'm writing some scripts for our sales people to query an index with elastic search through python. (Eventually the script will update lead info in our Salesforce DB.)

I have been using the urllib2 module, with simplejson, to pull results. The problem is that this seems to be a not-so-good approach, evidenced by scripts which are taking longer and longer to run.

Questions:

  1. Does anyone have any opinions (opinions, on the internet???) about Elastic Search clients for Python? Specifically, I've found pyes and pyelasticsearch, via elasticsearch.org---how do these two stack up?

  2. How good or bad is my current approach of dynamically building the query and running it via self.raw_results = simplejson.load(urllib2.urlopen(self.query))?

Any advice is greatly appreciated!

Upvotes: 4

Views: 788

Answers (2)

drewr
drewr

Reputation: 1786

It sounds like you have an issue unrelated to the client. If you can pare down what's being sent to ES and represent it in a simple curl command it will make what's actually running slowly more apparent. I suspect we just need to tweak your query to make sure it's optimal for your context.

Upvotes: 0

Julian Hille
Julian Hille

Reputation: 669

We use pyes. And its pretty neat. You can there go with the thrift protocol which is faster then the rest service.

Upvotes: 2

Related Questions