# Никак не могу отправить данные в elastic

**URL:** <https://discuss.elastic.co/t/elastic/267835>\
**Category:** Вопросы на русском языке\
**Created:** [March 19, 2021, 4:29pm UTC](https://discuss.elastic.co/t/elastic/267835 "2021-03-19T16:29:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleksandr\_Stelmakh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oleksandr_stelmakh/32/85825_2.png) [@Oleksandr\_Stelmakh](https://discuss.elastic.co/u/Oleksandr_Stelmakh)\
**Post date:** [March 19, 2021, 4:29pm UTC](https://discuss.elastic.co/t/elastic/267835/1 "2021-03-19T16:29:22Z")

</div>

Привет, я новенький и пытаюсь разобраться, мне нужно отправить данные, но выбивает  
ошибка и я не понимаю что не так, возможно кто-то может помочь

````
```
from elasticsearch import Elasticsearch, RequestsHttpConnection,Urllib3HttpConnection
import json
from elasticsearch import helpers

es = Elas ticsearch(
        hosts=[{'host': host, 'port': port}],
        api_key = ('api_id', 'api_key'),
        scheme="https",
        connection_class=RequestsHttpConnection)

document = {
    "title": "Moneyball",
    "director": "Bennett Miller",
    "year": "2011"
}

data = json.dumps(document)
actions = [{"_index": "index","_source":data}]
helpers.bulk(es, actions) 

````

```auto
 File "c:\Users\Stelmakh Oleksandr\Desktop\Pyton\Task\444.py", line 24, in <module>
       helpers.bulk(es, actions)
     File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\helpers\actions.py", line 399, in bulk
   for ok, item in streaming_bulk(client, actions, *args, **kwargs):
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\helpers\actions.py", line 320, in streaming_bulk     
   for data, (ok, info) in zip(
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\helpers\actions.py", line 249, in _process_bulk_chunk
   for item in gen:
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\helpers\actions.py", line 196, in _process_bulk_chunk_error
   raise error
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\helpers\actions.py", line 237, in _process_bulk_chunk     
   resp = client.bulk("\n".join(bulk_actions) + "\n", *args, **kwargs)
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\client\utils.py", line 152, in _wrapped
   return func(*args, params=params, headers=headers, **kwargs)
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\client\ __init__.py", line 454, in bulk
   return self.transport.perform_request(
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\transport.py", line 415, in perform_request
   raise e
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\transport.py", line 381, in perform_request
   status, headers_response, data = connection.perform_request(
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\connection\http_requests.py", line 204, in perform_request
   self._raise_error(response.status_code, raw_data)
 File "C:\Users\Stelmakh Oleksandr\AppData\Local\Programs\Python\Python39\lib\site-packages\elasticsearch\connection\base.py", line 322, in _raise_error
   raise HTTP_EXCEPTIONS.get(status_code, TransportError)(
elasticsearch.exceptions.NotFoundError: NotFoundError(404, 'Not Found', 'Not Found')
```

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [March 22, 2021, 3:16pm UTC](https://discuss.elastic.co/t/elastic/267835/2 "2021-03-22T15:16:17Z")

</div>

А что возвращается если запустить

```auto
curl https://<HOST>:<PORT>/ 

```

не том же компьютере и заманить `<HOST>:<PORT>`на значения переменных host и port

---

<div class="post-metadata">

**Author:** ![Oleksandr\_Stelmakh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oleksandr_stelmakh/32/85825_2.png) [@Oleksandr\_Stelmakh](https://discuss.elastic.co/u/Oleksandr_Stelmakh)\
**Post date:** [March 22, 2021, 5:00pm UTC](https://discuss.elastic.co/t/elastic/267835/3 "2021-03-22T17:00:19Z")

</div>

Спасибо, уже нашел решение в другом топике:

> [@Running Rally race on benchmark-only pipeline gives TransportError 302](https://discuss.elastic.co/t/running-rally-race-on-benchmark-only-pipeline-gives-transporterror-302/166397/2):
>
> Hello, Glad to hear you like Rally! The client options you specified look correct and should work. Could you please verify that you are specifying Elasticsearch Endpoint URL and not Kibana in --target-hosts? I get TransportError 302 if --target-hosts points to Kibana. Thank you, Evgenia

---

<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:** [April 19, 2021, 5:01pm UTC](https://discuss.elastic.co/t/elastic/267835/4 "2021-04-19T17:01:01Z")

</div>

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