# From Kibana devtools to Elasticsearch

**URL:** <https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215>\
**Category:** Kibana\
**Created:** [July 2, 2018, 1:16pm UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215 "2018-07-02T13:16:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yolo\_1900](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yolo_1900/32/32877_2.png) [@yolo\_1900](https://discuss.elastic.co/u/yolo_1900)\
**Post date:** [July 2, 2018, 1:16pm UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215/1 "2018-07-02T13:16:35Z")

</div>

Hello everyone.

I am very new to Elasticsearch and Kibana (in fact it is the first time I know the tools), so sorry for noob questions.

I can login to my kibana website (my-company.cloud) using my username and password, and using devtools (Console) I can put a call like:

```auto
GET nxxxx-2010.01.*/_search
{
  "query": {
    "match_all": {}
  }
}

```

And it returns to around 200K results (`hits": { "total": 204575,`)

Now I want to perform a same search in Python 3

So:

```auto
es = Elasticsearch ('my-company.cloud', httpauth=('username', 'password'))

page = es.search(
          
          index = ' nxxxx-2010.01.*',
          
          scroll = '2m',
        
          size = 1000,
          body = {
            "size":10,
            "query": {"match_all": {}}
        })

```

and I have the error `ERROR:root:TransportError(302, '')`

How can I transfer the query in Console Kibana to Python code?

Thanks

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [July 2, 2018, 4:32pm UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215/2 "2018-07-02T16:32:11Z")

</div>

is mycompany.cloud kibana or elasticsearch? It should be elasticsearch (the 302 is consistent with Kibana's root url).

The query looks fine, I'd try with some light cleanup and being explicit:

```auto
es = Elasticsearch([
        'http://username:password@my-company.cloud:9200/'
])

```

index = also seems to have a leading space on the index name, i'd try removing that

---

<div class="post-metadata">

**Author:** ![yolo\_1900](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yolo_1900/32/32877_2.png) [@yolo\_1900](https://discuss.elastic.co/u/yolo_1900)\
**Post date:** [July 3, 2018, 6:03am UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215/3 "2018-07-03T06:03:40Z")

</div>

> [@jbudz](#):
>
> '[http://username:password@my-company.cloud:9200/](http://username:password@my-company.cloud:9200/)'

Thanks for that, but now I have the error 404

---

<div class="post-metadata">

**Author:** ![yolo\_1900](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yolo_1900/32/32877_2.png) [@yolo\_1900](https://discuss.elastic.co/u/yolo_1900)\
**Post date:** [July 3, 2018, 10:04am UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215/5 "2018-07-03T10:04:53Z")

</div>

Here is the full error log:

```auto
Traceback (most recent call last):
 File "es.py", line 83, in download_job "query": {"match_all": {}}
     File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped return func(*args, params=params, **kwargs) File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/client/ __init__.py", line 655, in search doc_type, '_search'), params=params, body=body) File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/transport.py", line 318, in perform_request status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
                File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 185, in perform_request
                             self._raise_error(response.status, raw_data) File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/base.py", line 125, in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) elasticsearch.exceptions.NotFoundError: <unprintable NotFoundError object>
                                                                               During handling of the above exception, another exception occurred:
                                                                                      Traceback (most recent call last):
 File "/home/username/anaconda3/lib/python3.6/logging/ __init__.py", line 992, in emit msg = self.format(record)
      File "/home/username/anaconda3/lib/python3.6/logging/ __init__.py", line 838, in format return fmt.format(record)
      File "/home/username/anaconda3/lib/python3.6/logging/ __init__.py", line 575, in format record.message = record.getMessage() File "/home/username/anaconda3/lib/python3.6/logging/ __init__.py", line 336, in getMessage msg = str(self.msg)
            File "/home/username/anaconda3/lib/python3.6/site-packages/elasticsearch/exceptions.py", line 58, in __str__ cause = ', %r' % self.info['error']['root_cause'][0]['reason'] TypeError: string indices must be integers Call stack:
                        File "es.py", line 187, in <module> download_job ()
                File "es.py", line 167, in download_job logging.error(ex)
            Message: NotFoundError(404, 'Not Found', {'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}) Arguments: ()    

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 31, 2018, 10:05am UTC](https://discuss.elastic.co/t/from-kibana-devtools-to-elasticsearch/138215/6 "2018-07-31T10:05:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
