# Logstash bulk request to ElasticSearch error - may be due to old indexes

**URL:** https://discuss.elastic.co/t/logstash-bulk-request-to-elasticsearch-error-may-be-due-to-old-indexes/304943
**Category:** Logstash
**Created:** [May 17, 2022, 12:26pm UTC](https://discuss.elastic.co/t/logstash-bulk-request-to-elasticsearch-error-may-be-due-to-old-indexes/304943 "2022-05-17T12:26:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![DenSeb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/denseb/32/105784_2.png) [@DenSeb](https://discuss.elastic.co/u/DenSeb)
#### Post date: [May 17, 2022, 12:26pm UTC](https://discuss.elastic.co/t/logstash-bulk-request-to-elasticsearch-error-may-be-due-to-old-indexes/304943/1 "2022-05-17T12:26:23Z")

</div>

If you get these errors in LogStash :  
`Attempted to send a bulk request to elasticsearch' but Elasticsearch appears to be unreachable or down! {:error_message=>"Elasticsearch Unreachable: [http://localhost:9200/][Manticore::SocketTimeout] Read timed out", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError", :will_retry_in_seconds=>2}`  
Followed by:  
` Restored connection to ES instance {:url=>"http://localhost:9200/"`  
It may be due LogStash trying to send old data to ES but the index is missing or closed. Check whether you have timestamp based index settings.  
We had this issue and managed to resolve it by filtering out old messages using ruby filter plugin.

```auto
ruby {
  init => "require 'time'"
  code => 'if LogStash::Timestamp.new(event.get("@timestamp")+432000) < ( LogStash::Timestamp.now)
    event.cancel
  end'
}

```

---

<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: [June 14, 2022, 12:26pm UTC](https://discuss.elastic.co/t/logstash-bulk-request-to-elasticsearch-error-may-be-due-to-old-indexes/304943/2 "2022-06-14T12:26:44Z")

</div>

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