Resolve Bulk Index Request Rejection Error in ElasticSearch

One fine day, your ElasticSearch cluster starts rejecting write requests. You find following error in log, elasticsearch.helpers.errors.BulkIndexError: ('287 document(s) failed to index.', [{'index': {'_index': 'foo-bar', '_type': '_doc', '_id': '0086f6dbb767f5fa3eac0adf97031259', 'status': 429, 'error': {'type': 'es_rejected_execution_exception', 'reason': 'rejected execution of processing of [1095797768][indices:data/write/bulk[s][p]]: request: BulkShardRequest [[foo-bar][3]] containing [61] requests, target allocation id: Rhcq_0fjR5eTqj0LCOtIQw, primary term: 3 on EsThreadPoolExecutor[name = node-01/write, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@7a93b5a8[Running, pool size = 2, active threads = 2, queued tasks = 200, completed tasks = 268040145]]'}...

August 2, 2020 · Dinesh Sawant

Kines : CLI for Amazon Kinesis Data Stream

I used Amazon kinesis data stream to manage clickstream data. I found Kinesis stream service easy and effective, but the AWS CLI interface (aws kinesis) for kinesis was very raw in nature. Whenever I needed to debug few records in kinesis, I had to write 2-3 commands(i.e. creating shard iterator, and calling get records api). Also, the AWS CLI’s json output is not really Terminal friendly and the table output format is just horrible....

September 23, 2019 · Dinesh Sawant

ThreadLocal : Global container to store Thread's state

The Problem Java Developers of multi threaded application might feel a need to store global variables which should not be shared by multiple threads. Example - Storing user information while handling a web request on multi threaded server. Solution : ThreadLocal ThreadLocal object acts as a variable container which enables you to create and maintain a global state which is tied to one thread. Each thread accessing the ThreadLocal object will have it’s own copy of underlying variable....

October 1, 2018 · Dinesh Sawant

Gradle task to generate Flyway Database migration file

Flyway is a great tool to manage your database migrations. You can create incremental database migrations which will be applied on database. The concept is similar to Rails ActiveRecord migrations But unlike Rails ActiveRecord migrations, there is no built in create migration file feature present in Flyway Gradle plugin and it is not a priority for plugin developers. I have created following custom Gradle task to generate flyway db migration file....

August 18, 2018 · Dinesh Sawant

Jetty WebSocket with Spring Boot

👋 Update: There is a much cleaner way to use Jetty WebSocket with Spring Boot now. If you are working with latest Spring Boot and Jetty version follow this blog post. This post describes how to use Jetty WebSocket with Spring Boot. About this App I am going to build a websocket through which server will send random names to all it’s subscribers. At any given time all the subscribers will get same name....

November 26, 2017 · Dinesh Sawant