Skip to main content

Posts

Showing posts from January, 2025

Achieving Zero Downtime Updates in Elasticsearch

Greetings! Elasticsearch provides several methods for updating documents. However, not all of them are suitable for every use case. For instance, data migrations or scheduled ETL processes might lead to unexpected behavior and degrade the user experience. In these scenarios, Elasticsearch aliases can be leveraged to achieve seamless zero-downtime updates. What is an Alias? An alias is a logical name that acts as a pointer to one or more physical indexes. Instead of interacting directly with the index itself, applications or users can perform operations like indexing and search using an alias. Alias Switching Now, imagine we have index_v1 and want to transition to index_v2. The process involves simply updating the alia; removing index_v1 and adding index_v2. Since the applications interact with the alias rather than the indices directly, they remain unaware of the change, allowing the update to occur seamlessly without any downtime. Steps for Zero Downtime Update Before jumping in, let’...

A Beginner’s Guide to Elasticsearch CRUD Operations and Search with Python

Greetings! Search functionality is a common feature in most applications today. Elasticsearch, one of the most powerful and widely used search engines, offers efficient solutions for building search applications. In this article, we will create a simple REST application with a search endpoint using Elasticsearch and Python Flask. The code is straightforward and easy to understand. Setup Elasticsearch We are using the Elasticsearch Docker image to set up a local cluster; however, you can use any method you prefer to set up an Elasticsearch cluster. version: "3.9" services: elasticsearch: image: elasticsearch:8.6.2 environment: - xpack.security.enabled=false - discovery.type=single-node - ES_JAVA_OPTS=-Xms1g -Xmx1g volumes: - es_data:/usr/share/elasticsearch/data ports: - target: 9200 published: 9200 networks: - elastic kibana: image: kibana:8.6.2 ports: - target: 5601 published: 5601 depends_on: - ...