-1

I am new to python and elasticsearch and i am trying to run a sample application. But my elasticsearch connection shows some error. I have installed elasticsearch and started the server. In the application there is a code like this

ES_URL = ['thrift://127.0.0.1:9200']
connection = pyes.ES(ES_URL)
index = connection.indices.get_alias('staging-asset')

when .get_alias is called, it shows

Client error: timed out
Traceback (most recent call last):
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/pyes/connection.py", line 151, in _client_call
return getattr(conn.client, attr)(*args, **kwargs)
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/pyes/pyesthrift/Rest.py", line 41, in execute
return self.recv_execute()
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/pyes/pyesthrift/Rest.py", line 52, in recv_execute
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/thrift/protocol/TBinaryProtocol.py", line 126, in 
readMessageBegin
sz = self.readI32()
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/thrift/protocol/TBinaryProtocol.py", line 206, in readI32
buff = self.trans.readAll(4)
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/thrift/transport/TTransport.py", line 58, in readAll
chunk = self.read(sz - have)
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/thrift/transport/TTransport.py", line 159, in read
self.__rbuf = StringIO(self.__trans.read(max(sz, self.__rbuf_size)))
File "/Users/shahanahamza/.virtualenvs/cms/lib/python2.7/site-
packages/thrift/transport/TSocket.py", line 103, in read
buff = self.handle.recv(sz)
timeout: timed out

Please help me to figure out the issue. Thanks in advance.

shahana hamza
  • 107
  • 1
  • 1
  • 10

1 Answers1

1

As mentioned in the comment by @omri , you might need to increase default threshold timeout-

pyes.es.ES(server, timeout=30, bulk_size=500,max_retries=10)

you can read more about here

There can also be other reasons for this timeouts. Check this and see if its still happening.

Check your mappings also

tom
  • 3,720
  • 5
  • 26
  • 48
  • Why are we using thrift here? Cant we use http instead? and if thrift is used, is there any other port in which the server runs? How can i confirm whether the connection is established on the port? – shahana hamza May 23 '17 at 06:25