# Null result of MySQL query through logstash does not create an index

**URL:** <https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721>\
**Category:** Logstash\
**Created:** [August 21, 2017, 7:46am UTC](https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721 "2017-08-21T07:46:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saafianihan](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@saafianihan](https://discuss.elastic.co/u/saafianihan)\
**Post date:** [August 21, 2017, 7:46am UTC](https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721/1 "2017-08-21T07:46:06Z")

</div>

I have to Fetch the Today's status from my MYSQL table. Result From Table is empty. when i creating an index with null result of data the index does not created. What i am missing?  
this is my config file:

input {  
jdbc {  
jdbc\_driver\_library =\> "C:/New\_ELK/logstash-5.5.2/mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/emob\_report"  
jdbc\_user =\> "root"  
jdbc\_password =\> ""  
statement =\> "select \* from attendance  
where punchin\_date=curdate()"  
}  
}

output {  
elasticsearch {  
index =\> "users\_punched\_in"  
hosts =\> ["localhost:9200"]

}

stdout { codec =\> json\_lines }  
}

---

<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:** [August 21, 2017, 8:27am UTC](https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721/2 "2017-08-21T08:27:39Z")

</div>

Logstash does not actively create the index - Elasticsearch does this when it encounters the first document belonging to that index. If there is no data to index, no index will therefore be created.

---

<div class="post-metadata">

**Author:** ![saafianihan](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@saafianihan](https://discuss.elastic.co/u/saafianihan)\
**Post date:** [August 21, 2017, 10:17am UTC](https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721/3 "2017-08-21T10:17:20Z")

</div>

Thank You!!!

---

<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:** [September 18, 2017, 10:17am UTC](https://discuss.elastic.co/t/null-result-of-mysql-query-through-logstash-does-not-create-an-index/97721/4 "2017-09-18T10:17:21Z")

</div>

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