# How to make the Elasticsearch crud operation to be reflected in mysql database

**URL:** https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114
**Category:** Elasticsearch
**Created:** [June 23, 2018, 10:24am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114 "2018-06-23T10:24:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![suchetacateina](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@suchetacateina](https://discuss.elastic.co/u/suchetacateina)
#### Post date: [June 23, 2018, 10:24am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/1 "2018-06-23T10:24:59Z")

</div>

HI Folks,

I have installed ELK 6.2.3 on ubuntu 16.04. I have connected my sql database with ELK. I am able to see all the changes which have been done in mysql on ElasticSearch through search query . But when i am trying to perform CRUD operation on Elasticsearch , i am successful to make changes on Elastic search but those changes don't reflect on Mysql.

Is there a way to do that ? I am unable to find any changes on mysql. Please Help.

---

<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 23, 2018, 10:43am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/2 "2018-06-23T10:43:40Z")

</div>

You will need to handle that at the application layer and update The database at the same time you update Elasticsearch.

---

<div class="post-metadata">

### Author: ![suchetacateina](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@suchetacateina](https://discuss.elastic.co/u/suchetacateina)
#### Post date: [June 23, 2018, 11:41am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/3 "2018-06-23T11:41:07Z")

</div>

can't the updation done in ElasticSearch automatically reflect into mySQL database ?

---

<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 23, 2018, 11:59am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/4 "2018-06-23T11:59:21Z")

</div>

I am not aware of any mechanism to achieve that currently.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 23, 2018, 12:17pm UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/5 "2018-06-23T12:17:52Z")

</div>

> [@suchetacateina](#):
>
> I have connected my sql database with ELK

How?

---

<div class="post-metadata">

### Author: ![suchetacateina](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@suchetacateina](https://discuss.elastic.co/u/suchetacateina)
#### Post date: [June 25, 2018, 7:41am UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/6 "2018-06-25T07:41:31Z")

</div>

I am giving you the output of my logstash conf file below

```
` input {
                 jdbc {
                 jdbc_driver_library => "/../mysql-connector-java-5.1.45/mysql-connector-java-5.1.45-bin.jar"
                 jdbc_driver_class => "com.mysql.jdbc.Driver"
                 jdbc_connection_string => "jdbc:mysql://ipaddress:3306/ESBDB?autoReconnect=true"
                jdbc_user => "abc"
                jdbc_password => "abc"
                jdbc_paging_enabled => "true"
                jdbc_page_size => "5000000"
               schedule => "* * * * *"
              statement => "SELECT * from C_SYSTEM"
               use_column_value => true
               tracking_column => "%{SYS_ID}"
              clean_run => true
               }
                }
              filter {
              grok { match => ["message", "%{GREEDYDATA:message}"] }
                   }

         output {
          stdout {codec => json_lines}
        elasticsearch {
          hosts => ["ipaddress:9200"]
          index => "mysql_db"
         document_type => "test_elk_001"
           document_id => "%{sys_id}"
          }

        }`
```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 26, 2018, 2:50pm UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/7 "2018-06-26T14:50:13Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

Here it seems that your logstash configuration reads data from the database and writes to elasticsearch. Not the other way around. So what you described seems to be "normal" to me.  
If not please explain what you want to do.

My recommendation is to always do the updates in the database which will update Elasticsearch with LS. But not the other way.

---

<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 24, 2018, 3:01pm UTC](https://discuss.elastic.co/t/how-to-make-the-elasticsearch-crud-operation-to-be-reflected-in-mysql-database/137114/8 "2018-07-24T15:01:14Z")

</div>

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