Thanks Honza for your reply. While trying the below code with
print(es.info()) I am getting the below error.
pydev debugger: starting (pid: 9652)
GET / [status:401 request:0.563s]
Traceback (most recent call last):
File
"C:\Users\nimitja\Downloads\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\eclipse\plugins\org.python.pydev_3.6.0.201406232321\pysrc\pydevd.py",
line 1845, in
debugger.run(setup['file'], None, None)
File
"C:\Users\nimitja\Downloads\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\eclipse\plugins\org.python.pydev_3.6.0.201406232321\pysrc\pydevd.py",
line 1373, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File
"C:\Users\nimitja\Downloads\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\eclipse\plugins\org.python.pydev_3.6.0.201406232321\pysrc_pydev_execfile.py",
line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File
"C:\Users\nimitja\workspace\ParsingClientAndServerLogs\serverlog\KibanaRestAPIConnection.py",
line 12, in
print(es.info())
File "C:\Python34\lib\site-packages\elasticsearch\client\utils.py", line
68, in wrapped
return func(*args, params=params, **kwargs)
File "C:\Python34\lib\site-packages\elasticsearch\client_init.py",
line 159, in info
_, data = self.transport.perform_request('GET', '/', params=params)
File "C:\Python34\lib\site-packages\elasticsearch\transport.py", line
284, in perform_request
status, headers, data = connection.perform_request(method, url, params,
body, ignore=ignore, timeout=timeout)
File
"C:\Python34\lib\site-packages\elasticsearch\connection\http_urllib3.py",
line 55, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Python34\lib\site-packages\elasticsearch\connection\base.py",
line 97, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code,
error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(401, '')
Here the status is 401. Please help.
Regards,
Nimit Jain
On Thursday, 11 September 2014 14:56:10 UTC+5:30, Honza Král wrote:
Hi,
the code you have here should work, what do you get when you try:
from elasticsearch import Elasticsearch
es = Elasticsearch("10.120.xx.xxx:6xxx8")
print(es.info())
Thanks
On Thu, Sep 11, 2014 at 11:14 AM, Nimit Jain <online...@gmail.com
<javascript:>> wrote:
Hi All,
I need I need to call my server xxx.xx.xx.xxx:xxxxx using elasticsearch
api
in python but I am not able to get the proper code to run that. Below is
that I have done yet.
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch("10.120.xx.xxx:6xxx8")
print(es.cluster)
print(es.cat)
print(es.indices)
print(es.nodes)
print(es.snapshot)
but not deserialized
es.get(index="logstash-2014.09.11", doc_type="syslog",
id='iFP2D8nHSKeqevBWrm1Hgg')['_source']
{u'any': u'data', u'timestamp': u'2013-05-12T19:45:31.804229'}
print(es)
Please tell me what to do from here so I am doing wrong.
--
You received this message because you are subscribed to the Google
Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d33976fd-b4ea-4ce3-8e97-cd019b77b0f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7b51ba00-66e8-4ba8-9415-c49ea868ea0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.