No hits after indexing Mysql

Hello I'm fairly new to ES and I'm not quite sure what is not working here.

I have indexed a Mysql table with the following logstash config.

input {
jdbc {
jdbc_connection_string => "jdbc:mysql://"
jdbc_user => "root"
jdbc_validate_connection => true
jdbc_driver_library => "C:/Users/ggarciro/Documents/elastic/logstash-7.1.0/lib/mysql-connector-java-8.0.16.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
statement => "SELECT * FROM employees.employees where gender = 'M'"
output {
elasticsearch {
index => "male_employees"
document_id => "%{id}"
hosts => ["localhost:9200"]
user => "elastic"
password => "elastihusky"
stdout{ codec => json_lines}

However when i try to do a simple get as for example.

GET /male_employees/_search
"query": {
"match": {
"first_name": "Zsolt"

I get something like this

"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
"max_score" : null,
"hits" :

I see in the index stats this -> "index_total": 179973,

So I dont know why I don't get any hits.

Edit: For some reason the indexes health are displayed as yellow (I don't know why is that)
I have also restarted ES and Kibana, but I have still no hits.

Edit2: I think is adding all entries of the Mysql as one document under the same index, but I need each entry to be it's own.

What am I doing wrong?

Thank you

I have found the problem for the Edit2, turns out i was addressing all entries with the same id so they were being overwritten all the time, and now I get hits.

I still don't know why the health is yellow

If you are running on a single node but are configured to have replicas (which is on by default) then your health will always be yellow because the replicas cannot be assigned to a node.

Yeah that will be the case, I'm just playing with this so far so I configured it with one node.

Thank you

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