Skip to main content

Posts

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: - ...

GraphQL Essentials: From Basics to Federation

Greetings! Over the past two years, I have been engaging with GraphQL intermittently, not always as part of day-to-day development. However, now feels like the right time to consolidate key ideas into a comprehensive article. What is GraphQL? GraphQL is a query language for APIs and a runtime for executing those queries based on your data. It provides a more flexible and efficient alternative to traditional REST APIs by allowing clients to request only the data they need, reducing over-fetching and under-fetching. Unlike REST, where endpoints are tightly coupled to specific data structures, GraphQL operates on a single endpoint and allows dynamic queries. A GraphQL server Key Features of GraphQL Single Endpoint: All requests are sent to a single endpoint. Strongly Typed: A schema defines the data structure and enforces types. Declarative Queries: Clients specify the shape of the response they need. Real-time Support: Through subscriptions, clients can receive real-time updates. Introsp...