# Getting data into Elasticsearch

**URL:** <https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010>\
**Category:** Elasticsearch\
**Created:** [June 2, 2017, 2:16am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010 "2017-06-02T02:16:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pace](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pace](https://discuss.elastic.co/u/pace)\
**Post date:** [June 2, 2017, 2:16am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/1 "2017-06-02T02:16:12Z")

</div>

Hi all,

So i'm finding out that the documentation for the elasticstak is really not user friendly at all.

I have managed to get to grips with beats and logstash, but when it comes to getting my data into elasticsearch i'm hitting a brick wall.

From the default installation of elasticsearch, I understand that in order for me to get this data into elasticsearch, I first need to setup a user with the correct privileges.

I have read over this document more times that I would have liked, to no avail.

[Basic authentication](https://www.elastic.co/guide/en/x-pack/current/logstash.html)

Does anyone have an easy to read process for simply getting my data into elasticsearch.

Kind regards,

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 2, 2017, 5:43am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/2 "2017-06-02T05:43:53Z")

</div>

Have you got X-Pack installed? How have you configured it? What errors are you seeing?

---

<div class="post-metadata">

**Author:** ![pace](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pace](https://discuss.elastic.co/u/pace)\
**Post date:** [June 2, 2017, 6:58am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/3 "2017-06-02T06:58:15Z")

</div>

x-pack is installed for elasticsearch and kibana. Both elasticsearch and kibana are running.

`bin/elasticsearch`  
`bin/kibana`

I login to kibana at [http://localhost:5601/](http://localhost:5601/)

From a terminal I use the following commands for testing:

> curl -XPUT 'localhost:9200/idx'

`{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication token for REST request [/idx]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication token for REST request [/idx]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}`

From here I created a logstash writer role

> POST \_xpack/security/role/logstash\_writer  
> {  
> "cluster": ["manage\_index\_templates", "monitor"],  
> "indices": [  
> {  
> "names": ["logstash-\*"],  
> "privileges": ["write","delete","create\_index"]  
> }  
> ]  
> }

Then a logstash internal user:

> POST \_xpack/security/user/logstash\_internal  
> {  
> "password" : "changeme",  
> "roles" : ["logstash\_writer"],  
> "full\_name" : "Internal Logstash User"  
> }

I then ran the following command from the terminal to test the setup:

> curl --user logstash\_internal:changeme -XPUT 'localhost:9200/idx'

`{"error":{"root_cause":[{"type":"security_exception","reason":"action [indices:admin/create] is unauthorized for user [logstash_internal]"}],"type":"security_exception","reason":"action [indices:admin/create] is unauthorized for user [logstash_internal]"},"status":403}`

If I add the superuser role to logstash\_internal and run:

> curl --user logstash\_internal:changeme -XPUT 'localhost:9200/idx'

`{"acknowledged":true,"shards_acknowledged":true}`

How can I get this to work without the superuser role?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 2, 2017, 8:01am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/4 "2017-06-02T08:01:11Z")

</div>

I moved this to the X-Pack category.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [June 2, 2017, 10:14am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/5 "2017-06-02T10:14:48Z")

</div>

> "names": ["logstash-\*"],

Your `logstash_writer` role only grants access to indices that match the `logstash-*` pattern.

> [quote=", post:3, topic:88010"]  
> -XPUT 'localhost:9200/idx'  
> [/quote]

But here you are trying to create an index named `idx`.

You either need to change your role to allow access to other index names, or PUT something like `logstash-test`

---

<div class="post-metadata">

**Author:** ![pace](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pace](https://discuss.elastic.co/u/pace)\
**Post date:** [June 3, 2017, 3:36am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/6 "2017-06-03T03:36:47Z")

</div>

Tim, thank you so much, i'm such an idiot !

You saved me from pulling out anymore of my hair 😂

---

<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 1, 2017, 3:37am UTC](https://discuss.elastic.co/t/getting-data-into-elasticsearch/88010/7 "2017-07-01T03:37:02Z")

</div>

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