<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Khushi Malhotra on Medium]]></title>
        <description><![CDATA[Stories by Khushi Malhotra on Medium]]></description>
        <link>https://medium.com/@khushimalhoz?source=rss-52d81d79fd1a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QTWy-yyEBRoIejl2</url>
            <title>Stories by Khushi Malhotra on Medium</title>
            <link>https://medium.com/@khushimalhoz?source=rss-52d81d79fd1a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:29:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khushimalhoz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pod affinity and Pod anti-affinity]]></title>
            <link>https://medium.com/@khushimalhoz/pod-affinity-and-pod-anti-affinity-7adffbf994bc?source=rss-52d81d79fd1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7adffbf994bc</guid>
            <category><![CDATA[pod-anti-affinity]]></category>
            <category><![CDATA[pod-affinity]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[affinity]]></category>
            <category><![CDATA[kubectl]]></category>
            <dc:creator><![CDATA[Khushi Malhotra]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 15:07:44 GMT</pubDate>
            <atom:updated>2024-08-16T15:08:11.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1t4T2Al73VmlXvqJ" /></figure><h4>What is Pod affinity and Pod anti-affinity? 🥸</h4><p><em>Pod affinity</em> allow you to constrain which node your pod is eligible to be scheduled based on labels on pods that are already running on the node.</p><p>Pod anti-affinity is the opposite which ensures that certain pods donot run on the same nodes.</p><p><strong>Scenario:</strong> Imagine you’re organizing a party, and you want to make sure certain groups of friends sit together or at least at nearby tables. You might also want to make sure that people who don’t get along sit far apart.</p><p><strong>Pod Affinity:</strong></p><ol><li><strong>Pod Affinity (Friends Sitting Together):</strong></li></ol><ul><li>You have a group of friends who are close, and you want them to sit at the same table or nearby tables. In Kubernetes, if you have two services (let’s say a web server and a caching server) that work closely together, you can use <strong>pod affinity</strong> to ensure that these pods are scheduled on the same node or close to each other. This can help reduce latency or improve communication between these services.</li><li><strong>Example:</strong> You have a web server and a database that communicate frequently. You want them to be scheduled on the same node to minimize network latency. So, you use pod affinity to ensure that wherever the web server pod is scheduled, the database pod should also be scheduled there.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6soKWYLKIPkcRZ3cj21YA.png" /></figure><p><strong>Pod Anti-Affinity:</strong></p><p><strong>Pod Anti-Affinity (Enemies Sitting Apart):</strong></p><ul><li>Now, think of two people at your party who don’t get along. You want to make sure they sit as far apart as possible. Similarly, in Kubernetes, you might want to prevent certain pods from being scheduled on the same node to ensure redundancy or to avoid resource contention. This is where <strong>pod anti-affinity</strong> comes in.</li><li><strong>Example:</strong> You have two replicas of the same application (for example, two instances of a web server). To ensure high availability, you don’t want them on the same node because if that node fails, both replicas would go down. You can use pod anti-affinity to make sure that each replica is scheduled on a different node.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0GiVPcFPUL6UJ4odLgvAw.png" /></figure><p>How we can define them and what all attributes are included in it, we will be discussing this in our next blog. <br>Thanks for reading.😉<br>See you again. 🫠</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7adffbf994bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Elasticsearch Works?]]></title>
            <link>https://medium.com/@khushimalhoz/how-elasticsearch-works-8933ecd91efa?source=rss-52d81d79fd1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8933ecd91efa</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[indexing]]></category>
            <category><![CDATA[lucene]]></category>
            <category><![CDATA[solr]]></category>
            <dc:creator><![CDATA[Khushi Malhotra]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 13:11:59 GMT</pubDate>
            <atom:updated>2024-08-12T13:11:59.931Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kCFO1wJyVu0gvrmejXaxtA.png" /></figure><p><strong><em>How elastic search works?</em></strong></p><p><strong>1. Data Ingestion</strong></p><p><strong><em>Data Submission:</em></strong> Data is sent to Elasticsearch in JSON format, usually via its REST API or ingestion plugins for various data sources.<br>Analysis and Parsing: Elasticsearch automatically analyzes and parses the incoming data, identifying text fields, numbers, dates, geolocations, and more to understand its structure and prepare for indexing.</p><p><strong>2. Indexing</strong></p><p><strong><em>Inverted Index Creation:</em> </strong>Elasticsearch constructs a highly optimized inverted index, mapping words and their locations within documents. This acts like a book’s index, enabling lightning-fast retrieval of relevant information.<br><strong><em>Field Analysis:</em></strong><em> </em>Elasticsearch applies appropriate analyzers to text fields to break down text into tokens (words or phrases) for indexing, considering factors like language, stemming, and synonyms.<br><strong><em>Document Storage:</em></strong> Indexed documents are stored in shards, ready for searching.</p><p><strong>3. Sharding and Replication</strong></p><p><strong><em>Sharding:</em> </strong>Elasticsearch divides indices into smaller units called shards, distributing them across multiple nodes in a cluster. This enables horizontal scaling and parallel processing.<br><strong><em>Replication:</em></strong> Copies of shards, called replicas, are created to ensure fault tolerance and boost read performance. If a node fails, replicas take over, ensuring data availability.</p><p><strong>4. Querying</strong></p><p><strong><em>Query Submission:</em></strong> Users submit search queries through Elasticsearch’s REST API or a query language like Elasticsearch Query DSL.<br><strong><em>Query Parsing:</em></strong><em> </em>Elasticsearch analyzes the query, identifying keywords, filters, and other search parameters.</p><p><strong>5. Search Execution</strong></p><p><strong><em>Inverted Index Lookup:</em></strong> Elasticsearch leverages the inverted index to quickly locate matching documents based on the query terms.<br><strong><em>Scoring:</em></strong> Elasticsearch applies scoring algorithms (like TF-IDF) to rank results based on relevance to the query, ensuring the most relevant results appear first.</p><p><strong>6. Result Collection and Aggregation</strong></p><p><strong><em>Document Fetching: </em></strong>Elasticsearch retrieves the top-ranked documents from the relevant shards.<br><strong><em>Aggregations (Optional):</em></strong> If the query involves aggregations (e.g., counts, averages, groupings), Elasticsearch performs those calculations to summarize and analyze the data.</p><p><strong><em>7. Result Presentation</em></strong></p><p><strong><em>JSON Response:</em></strong> Elasticsearch returns the search results in JSON format, typically containing document information, scores, and any requested aggregations.<br><strong><em>Formatting and Display: </em></strong>Applications consuming the results can format and present them to users in user-friendly ways, such as lists, grids, or visualizations.</p><h3>Elasticsearch and Apache Solr</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbqP8kx6CXWx_uCithp7xg.png" /></figure><h3>Key Differences Between Solr and Elasticsearch</h3><h4>Focus</h4><ul><li><strong>Solr</strong>: More focused on traditional search and analytics.</li><li><strong>Elasticsearch</strong>: Excels in real-time search, analytics, and data exploration.</li></ul><h4>Architecture</h4><ul><li><strong>Solr</strong>: Based on Apache Lucene.</li><li><strong>Elasticsearch</strong>: A standalone solution built on Apache Lucene.</li></ul><h4>Deployment</h4><ul><li><strong>Solr</strong>: Often requires more manual configuration and setup.</li><li><strong>Elasticsearch</strong>: Generally easier to deploy and manage.</li></ul><h4>Scaling</h4><ul><li><strong>Elasticsearch</strong>: Designed for horizontal scaling, ideal for large-scale data sets.</li><li><strong>Solr</strong>: Can scale as well, but may require more manual effort.</li></ul><h4>Analytics Capabilities</h4><ul><li><strong>Elasticsearch</strong>: Offers robust analytics features, including aggregations, visualizations, and machine learning capabilities.</li><li><strong>Solr</strong>: Has some analytics features, but they aren’t as comprehensive.</li></ul><h4>Ecosystem</h4><ul><li><strong>Elasticsearch</strong>: Has a larger and more active community, offering a wider range of plugins, integrations, and support resources.</li></ul><h3>Specific Advantages</h3><h4>Solr</h4><ul><li>Strong focus on traditional search and analytics.</li><li>Handles rich text formats (RTF) effectively.</li><li>Can be more performant for specific use cases.</li><li>Offers a more granular level of control over configuration.</li></ul><h4>Elasticsearch</h4><ul><li>Excels in real-time search and data exploration.</li><li>Easier to deploy and manage.</li><li>Better suited for large-scale data sets.</li><li>More comprehensive analytics features.</li><li>Larger and more active community.</li></ul><h3>Use Cases</h3><h4>Solr</h4><ul><li>E-commerce search</li><li>Content management systems</li><li>Enterprise search</li><li>Library catalogs</li></ul><h4>Elasticsearch</h4><ul><li>Log analysis</li><li>Real-time monitoring</li><li>Application performance monitoring</li><li>Security analytics</li><li>Fraud detection</li></ul><h3>Choosing the Right Tool</h3><ul><li><strong>Prioritize Solr</strong> if you need a highly customizable search solution with a strong focus on traditional search and analytics.</li><li><strong>Opt for Elasticsearch</strong> if you require real-time search, analytics, scalability, and comprehensive data exploration capabilities.</li></ul><h4>Which companies uses elastic search? 🫠</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5Un8frko391YLgCv2-taw.png" /></figure><h3>Tech</h3><ul><li><strong>Netflix</strong>: Powers their search and recommendation algorithms.</li><li><strong>Uber</strong>: Enables efficient location-based search for drivers and riders.</li><li><strong>Shopify</strong>: Supports product search and analytics for online stores.</li><li><strong>Udemy</strong>: Drives course search and discovery for learners.</li><li><strong>GitHub</strong>: Powers code search and analysis functionality.</li></ul><h3>E-commerce</h3><ul><li><strong>eBay</strong>: Drives product search and discovery for millions of users.</li><li><strong>Staples</strong>: Enables efficient product filtering and search on their website.</li><li><strong>Magento</strong>: Provides search functionality for online stores built on the platform.</li></ul><h3>Media and Entertainment</h3><ul><li><strong>The Guardian</strong>: Powers news search and content discovery.</li><li><strong>New York Times</strong>: Enhances article search and analysis capabilities.</li><li><strong>Spotify</strong>: Supports music search and recommendation algorithms.</li></ul><p><strong><em>Finally the End of Elasticsearch series. 😉</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8933ecd91efa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node, Cluster, Document, Shards, Index and Replicas? ]]></title>
            <link>https://medium.com/@khushimalhoz/node-cluster-document-shards-index-and-replicas-c1f665375dcf?source=rss-52d81d79fd1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1f665375dcf</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[elastic]]></category>
            <dc:creator><![CDATA[Khushi Malhotra]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 12:40:30 GMT</pubDate>
            <atom:updated>2024-08-12T13:13:34.333Z</atom:updated>
            <content:encoded><![CDATA[<p>So many terminology in Elasticsearch. Lets go ahead. 😉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbR4eF2qYi8I11uYuul98w.png" /><figcaption>Concept Related to Elasticsearch.</figcaption></figure><h3><strong>NODE 🙂‍↕️</strong></h3><p><strong><em>Scenario:</em></strong> <strong>Imagine you run a news website with millions of articles stored in Elasticsearch. Your audience demands fast and accurate search results, so you need a robust search engine setup.</strong></p><p><strong><em>Here’s how nodes come into play:</em></strong></p><p><strong>Cluster Architecture:</strong> You set up a cluster of multiple nodes, say three nodes (Node A, Node B, and Node C). Each node holds a subset of your data shards (small partitions of your entire dataset).<br><strong>Data Distribution:</strong> Elasticsearch automatically distributes your articles across the nodes. For example, Node A might hold articles about sports, Node B for politics, and Node C for technology. This distribution balances the load and enhances search speed.<br><strong>Search Requests:</strong> When a user searches for “breaking news,” the request goes to the cluster coordinator, who identifies the relevant nodes (e.g., Node B for politics and Node C for technology).<br><strong>Parallel Processing:</strong> Each relevant node searches its own data shards for “breaking news,” processing the search in parallel. This simultaneous processing significantly increases search speed compared to a single-node setup.<br><strong>Result Aggregation:</strong> Each node returns its search results to the coordinator, who merges them into a single, ranked list of articles. This list is then presented to the user, showing the most relevant articles regardless of which node they were found on.</p><p><strong><em>Benefits of Nodes</em></strong></p><p><strong>Scalability: </strong>Adding more nodes allows you to handle larger data volumes and increased search traffic. Imagine adding Node D to handle entertainment articles as your website grows.<br><strong>High Availability:</strong> If one node fails, the other nodes continue to operate, ensuring your search engine remains available. This fault tolerance is crucial for mission-critical applications.<br><strong>Improved Performance:</strong> Parallel processing on multiple nodes leads to faster search speeds and better responsiveness for your users.</p><h3><strong>CLUSTER 🧐</strong></h3><p><strong><em>Scenario:</em></strong> <strong>Imagine you own a large online bookstore with millions of books and a bustling customer base. To provide excellent search experiences, you need a powerful and scalable search engine solution.</strong></p><p><strong><em>Enter the Elasticsearch Cluster:</em></strong></p><p><strong>Multiple Nodes:</strong> You set up a cluster with several nodes (say, three: Node A, Node B, and Node C). Each node stores a portion of your book data — think genres, authors, or publication dates.<br><strong>Shared Data and Workload:</strong> The nodes share the responsibility of indexing, searching, and storing your book data. This means any node can participate in processing search queries and managing data.<br><strong>Cluster Coordinator: </strong>One node in the cluster, usually elected automatically, acts as the coordinator. It handles tasks like distributing traffic, coordinating searches across nodes, and ensuring overall cluster health.<br><strong>Fault Tolerance:</strong> If one node fails, the other nodes in the cluster seamlessly pick up the load, ensuring your search engine remains available and operational. This redundancy protects against hardware failures or outages.<br><strong>Scalability:</strong> As your book collection and customer base grow, you can simply add more nodes to the cluster. This horizontal scaling lets you handle increasing data volumes and search traffic without major disruptions.</p><p><strong><em>Benefits of Clusters:</em></strong></p><p><strong>High Availability:</strong> Redundancy across nodes ensures continuous search capabilities even if individual nodes face issues.<br><strong>Scalability:</strong> Adding or removing nodes allows you to adapt to changing data demands and search traffic.<br><strong>Performance: </strong>Parallelized processing across nodes enhances search speed and responsiveness for your users.<br><strong>Centralized Management: </strong>You manage the entire cluster as a single entity, simplifying configuration and monitoring tasks.</p><h3><strong>INDEX 🥸</strong></h3><p><strong><em>Scenario: </em>You’re the data architect for a popular music streaming platform with millions of songs from diverse genres. Your users expect efficient searches based on artist, title, year, or genre.</strong></p><p><strong><em>Here’s where indices come into play:</em></strong></p><p><strong>Multiple Indices:</strong> You decide to create two separate indices: songs and artists. The songs index stores information about individual songs, like title, artist, album, release year, and genre. The artists index holds details about artists, including name, biography, and genres.<br><strong>Document Structure:</strong> Each document in the songs index would have fields like title, artist_id, release_year, and genre. Similarly, the artists index would have documents with fields like name, biography, and genres.<br><strong>Sharding and Replication:</strong> For each index, Elasticsearch automatically divides the data into smaller units called shards, distributed across your cluster nodes. This increases search speed and scalability. You can also set up replicas of each shard for redundancy and fault tolerance.<br><strong>Mapping and Queries:</strong> Each index has a mapping that defines the structure of its documents, specifying field types and search behavior. This allows you to tailor the search experience for each index. For example, you might enable full-text search on song titles in the songs index but not in artist names in the artists index.</p><p><strong><em>Benefits of Indices:</em></strong></p><p><strong>Optimized Search: </strong>Separate indices provide focused search and faster results by restricting searches to relevant data.<br><strong>Data Organization:</strong> Grouping related data into distinct indices keeps your storage structure organized and simplifies management.<br><strong>Security and Access Control: </strong>You can define specific access and security policies for individual indices, protecting sensitive data and tailoring user experiences.<br><strong>Scalability:</strong> Adding more data doesn’t require expanding a single index; you can create new indices for future content or data types.</p><h3><strong>DOCUMENT 📑</strong></h3><p><strong><em>Scenario: </em>Your online movie platform boasts thousands of films across various genres and release dates. Users crave detailed search experiences based on movie titles, directors, actors, and ratings.</strong></p><p><strong><em>Here&#39;s where documents come to life:</em></strong></p><p><strong>Individual Films:</strong> Each film in your catalog becomes a separate document in your Elasticsearch &quot;movies&quot; index. This document holds all the relevant information about the film, like title, director, cast, release year, genre, synopsis, and rating.<br><strong>JSON Structure:</strong> Elasticsearch documents are stored in JSON format, making them flexible and adaptable to varied data types. For example, the &quot;cast&quot; field might be an array of actor names, while the &quot;synopsis&quot; could be a string of text.<br><strong>Field-Level Search: </strong>Each field within a document is searchable. Users can query based on specific criteria like &quot;comedy movies released in 2023&quot; or &quot;films starring Tom Hanks.&quot;<br><strong>Aggregations and Analytics:</strong> Documents facilitate analyzing and aggregating data. You can find top-rated movies in a specific genre, average critic scores for directors, or track user preferences based on their searches and watched movies.</p><p><strong><em>Benefits of Documents:</em></strong></p><p><strong>Flexible Data Modeling: </strong>JSON structure allows you to adapt document formats to diverse data types and evolve them as needed, unlike rigid database schemas.<br><strong>Granular Search and Analysis: </strong>Searchable fields within documents enable precise queries and detailed data analysis, enriching user experiences and supporting insightful decision-making.<br><strong>Horizontal Scalability: </strong>As your movie collection grows, adding more documents doesn&#39;t overload a single entity. Elasticsearch can readily distribute new documents across available nodes in your cluster.<br><strong>Simple Data Access:</strong> Documents represent readily understandable units of information, simplifying querying and retrieval compared to complex table relationships in traditional databases.</p><h3>SHARDS 😶‍🌫️</h3><p><strong>Shards play a crucial role in distributing and managing your data<br><em>Scenario:</em>You own a popular e-commerce platform with millions of product listings spanning diverse categories. Users expect lightning-fast searches based on product names, descriptions, brands, and prices.</strong></p><p><strong><em>Here’s where shards come into play:</em></strong></p><p><strong>Data Chunking:</strong> Elasticsearch automatically divides your product data into smaller units called shards. For example, you might split your millions of products into 100 shards, with each shard holding approximately 10,000 products.<br><strong>Distributed Storage:</strong> These shards are then distributed across different nodes in your Elasticsearch cluster. This means, different nodes in your setup contain different sets of product data.<br><strong>Parallel Processing: </strong>When a user searches for “blue shoes,” the search request goes to the cluster coordinator. The coordinator identifies the relevant shards across various nodes (e.g., shards containing shoes) and distributes the search query to these nodes.<br><strong>Simultaneous Searching:</strong> Each node holding a relevant shard independently searches its portion of data for “blue shoes,” effectively processing the search in parallel. This significantly increases search speed compared to searching a single large dataset.<br><strong>Fault Tolerance: </strong>If a node containing one or more shards fails, other nodes holding replicas of those shards take over, ensuring data availability and uninterrupted search experiences.</p><p><strong><em>Benefits of Shards:</em></strong></p><p><strong>Scalability: </strong>You can easily add more shards to your cluster as your data volume grows. This horizontal scaling lets you handle increasing product listings without major disruptions.<br><strong>Search Performance: </strong>Parallel processing across shards dramatically improves search speeds, providing users with faster and more responsive search experiences.<br><strong>Fault Tolerance: </strong>Replicated shards guarantee data availability even if individual nodes face issues, protecting you from data loss and service disruptions.<br><strong>Improved Cluster Management:</strong> Smaller individual shards simplify cluster management tasks like adding nodes, performing rolling upgrades, or fine-tuning search configurations.</p><h3>REPLICAS 😏</h3><p><strong><em>Redundant Data:</em> You decide to set up replicas for your “news” index. This means for every shard in the “news” index, you create an exact copy on another node in your cluster. So, if your index has 100 shards, you’ll have 200 shards in total, 100 originals and 100 replicas.</strong></p><p><strong>Fault Tolerance:</strong> If a node containing an original shard encounters issues, its replica on another node automatically takes over, ensuring data availability and uninterrupted search experiences for your users. Imagine a power outage on one node; readers can still access all news articles through the replicas on other nodes.<br><strong>Improved Read Performance:</strong> Replicas can also be used to offload read traffic from the primary shards. This means search requests can be distributed between original and replica shards, reducing the load on individual nodes and further enhancing search speed and responsiveness. Imagine high user traffic during a breaking news event; replicas help handle surges by sharing search burdens.<br><strong>Data Consistency: </strong>Maintaining consistency between original and replica shards is crucial. Elasticsearch uses different strategies (sync or async) to ensure replicas reflect updates made to the originals, guaranteeing users access to the latest information. Think of keeping both the original library and its backup updated with the newest books.</p><p><strong><em>Benefits of Replicas:</em></strong></p><p><strong>High Availability:</strong> Replicas prevent data loss and service disruptions if individual nodes fail, assuring continuous access to your critical data.<br><strong>Improved Read Performance: </strong>By sharing search traffic, replicas can significantly enhance search speed and responsiveness, especially during peak load times.<br><strong>Cluster Flexibility: </strong>You can configure the number of replicas per shard based on your needs. More replicas offer greater fault tolerance but consume additional storage space. Choose the balance that suits your data and performance requirements.<br><strong>Enhanced Disaster Recovery: </strong>Replicas stored on separate nodes or even clusters can act as secondary data backups, helping you recover from broader system failures or disasters.<br>Replicas play a vital role in ensuring data availability and resilience.</p><p><a href="https://medium.com/@khushimalhoz/how-elasticsearch-works-8933ecd91efa"><strong><em>For more in-depth discussions on Elasticsearch, be sure to check out my upcoming blog post. How Elasticsearch works? 🧐</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1f665375dcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elasticsearch]]></title>
            <link>https://medium.com/@khushimalhoz/elasticsearch-0b90337a4469?source=rss-52d81d79fd1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b90337a4469</guid>
            <category><![CDATA[elasticsearch-cluster]]></category>
            <category><![CDATA[elasticsearch-service]]></category>
            <category><![CDATA[elastic]]></category>
            <category><![CDATA[elastic-stack]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Khushi Malhotra]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 11:09:07 GMT</pubDate>
            <atom:updated>2024-08-12T12:44:21.866Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*mRKGW2hKNiLzhtKH.jpg" /></figure><p>Unleashing the Power of Search<br><strong>Presented by:- KHUSHI MALHOTRA</strong></p><p><strong>What is Elasticsearch?<br></strong>A distributed, open-source search engine built on top of Apache Lucene</p><ul><li>Highly scalable and fault-tolerant</li><li>Capable of indexing and searching large volumes of data in real-time</li></ul><p><strong><em>CONFUSED😕 Let me Explain my child.🧒</em></strong></p><p>Imagine you have a <em>massive library</em>, but instead of books on dusty shelves, you have all the information stored digitally on computers. Now, finding a specific book in this library would be a huge task, right? That’s where Elasticsearch comes in!</p><p>Think of Elasticsearch as a super-powered librarian who helps you find the information you need quickly and easily. It’s like a search engine for your own data, but much more powerful and flexible.</p><p>Here’s how it works in simpler terms:</p><p><em>Store your information:</em> You give Elasticsearch all your data, like articles, emails, social media posts, or even sensor readings from machines. Elasticsearch organizes it all neatly, making it searchable.<br><em>Ask your questions:</em> Instead of browsing through everything, you tell Elasticsearch what you’re looking for. You can ask specific questions like “Find all emails from Khushi about the meeting on Monday” or “Show me articles about AI that were published this month.”<br><em>Get instant answers:</em> Elasticsearch uses its special search powers to scan through all your data and find exactly what you need. It’s like having a super-fast librarian who knows exactly where every book is and can bring it to you in a flash.</p><p><strong>Elasticsearch</strong> is a <strong>real-time distributed</strong> and <strong>open-source full-text search</strong> and <strong>analytics engine</strong>. <br><strong>Elasticsearch is an Apache Lucene-based search server.</strong></p><p><strong><em>Apache Lucene? Inverted Index??😕 Abb yeh khan se aagaya?😂</em></strong> <strong><em>Mein battati huin…☺</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gDgm352ibhFFAfMOt879Q.png" /></figure><p><strong>Apache Lucene</strong></p><p>Imagine you have a large collection of e-books in various formats (PDF, EPUB, etc.):</p><p><strong>Indexing:</strong> Lucene would use its analyzers to process each e-book Extracting text content Breaking it down into individual words and phrases (tokens)<br>Creating an inverted index that maps these tokens to their locations within each book Storing metadata like title, author, and file format.<br>Searching: When a user searches for “artificial intelligence,” Lucene would:</p><p>Quickly scan the inverted index to find books containing those terms Calculate relevance scores based on factors like term frequency, proximity, and field weighting.<br>Ranking: Lucene would present the most relevant books first, potentially highlighting matching terms within excerpts or summaries.</p><p><strong>How Apache Lucene helps Elasticsearch?</strong></p><p><strong>Lucene’s Foundational Role:</strong></p><p><strong><em>Core Search Engine</em></strong>: Lucene forms the underlying engine that powers Elasticsearch’s search capabilities. It provides essential features like:<br><strong>- Indexing documents<br>- Analyzing text<br>- Building inverted indexes<br>- Searching for and ranking relevant results<br>- Highlighting matching terms</strong></p><p>Elasticsearch’s Value-Added Layers</p><p><strong><em>Distributed Architecture</em></strong>: Elasticsearch extends Lucene’s capabilities to handle massive datasets across multiple servers, enabling horizontal scaling and fault tolerance.</p><p><em>Advanced Features:</em><strong><em> </em></strong><em>Elasticsearch adds functionalities beyond Lucene’s core, including:</em><br><strong>- Aggregations for data summarization and analysis<br>- Filtering to narrow down results based on specific criteria<br>- Autocomplete for suggesting queries as users type<br>- Near real-time search for near-instantaneous results<br>- Geospatial search for location-based queries</strong></p><p><strong>Key Benefits of Lucene for Elasticsearch:</strong></p><p><strong>Proven Search Algorithms: </strong>Elasticsearch inherits Lucene’s well-tested and efficient search algorithms, ensuring high-quality search results.<br><strong>High-Performance Indexing and Search:</strong> Lucene’s inverted index structure and optimization techniques enable fast indexing and retrieval of documents.<br><strong>Flexible Text Analysis:</strong> Lucene’s customizable analyzers allow Elasticsearch to handle diverse text data in different languages and domains.<br><strong>Scalability and Reliability:</strong> Elasticsearch leverages Lucene’s strengths to build a distributed search platform that can scale horizontally and tolerate failures.<br><strong>Rich Feature Set:</strong> Elasticsearch builds upon Lucene’s core to offer a broader range of features, making it a versatile tool for various search and analytics use cases.</p><h4><strong>Inverted Index</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*IzDZBmBZJQzHgOWA.png" /></figure><p>An Inverted Index is a data structure used in information retrieval systems to efficiently retrieve documents or web pages containing a specific term or set of terms. In an inverted index, the index is organized by terms (words), and each term points to a list of documents or web pages that contain that term.</p><p>Inverted indexes are widely used in search engines, database systems, and other applications where efficient text search is required. They are especially useful for large collections of documents, where searching through all the documents would be prohibitively slow.</p><p>An inverted index is an index data structure storing a mapping from content, such as words or numbers, to its locations in a document or a set of documents. <br>The term “inverted index” refers to the structure and organization of an index in a way that is the opposite (or inverted) from the way data is typically stored.</p><p><strong>Elastic search is used for <em>SINGLE PAGE APPLICATION.</em></strong><br>Single-page applications often deal with large amounts of dynamic data displayed on a single page. Elasticsearch excels at indexing and searching this data, allowing users to find specific information quickly and easily, even through complex queries. This can enhance user experience significantly and make your SPA feel more responsive.<br><strong>Real-time updates:</strong> With features like “refresh” and “scroll”, Elasticsearch can handle data updates in real-time, meaning changes in your SPA’s data are reflected in search results instantly. This keeps your users informed and avoids the need for page refreshes.<br><strong>Scalability:</strong> As your SPA grows and user traffic increases, Elasticsearch can scale horizontally to handle increased load. This means your search functionality and analytics remain performant even with large datasets and high user numbers.</p><p><strong>KEY FEATURES</strong><br>1. <strong>Full-text search (FTS)</strong> is a technique for searching text-based content for specific words or phrases<br>2. <strong>Real-time indexing</strong> refers to the process of adding new data to an index as it becomes available, with minimal latency. In the context of search engines and databases like Elasticsearch, real-time indexing is crucial for providing up-to-date and accurate search results or data analysis.<br>3. <strong>Horizontal scaling </strong>also known as scaling out, is an approach to increase the capacity or performance of a system by adding more hardware or instances to the existing infrastructure. <br>4. <strong>Fault Tolerance</strong> is crucial for ensuring the availability and reliability of search and indexing services, especially in distributed and large-scale environments.<br>5. <strong>Node-Level Fault Tolerance</strong> Elasticsearch clusters consist of multiple nodes, and the loss of a single node should not lead to a significant disruption. The system automatically redistributes shards and adjusts the cluster state when nodes join or leave.</p><h3><strong>Use cases of Elasticsearch</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*MpfSpmlzznuJlYUKqwPV0A.png" /></figure><p><strong>1. Web Search:</strong></p><p><strong>Indexing:</strong> Crawls website pages, extracts text and data, and builds an inverted index for rapid searching.<br><strong>Full-text search:</strong> Users can search for specific keywords, phrases, or even synonyms across large volumes of content.<br><strong>Relevance ranking:</strong> Results are ranked based on factors like keyword frequency, page authority, and user history.<br><strong>Facets and filtering:</strong> Users can refine their search using filters like category, date, or author.<br><strong>Real-time updates:</strong> Changes to website content are reflected in search results almost instantly.<br><strong><em>Examples: Wikipedia, Stack Overflow, GitHub, news websites.</em></strong></p><p><strong>2. E-commerce Search:</strong></p><p><strong>Product Indexing:</strong> Indexes product details like title, description, specifications, and tags.<br><strong>Autocomplete and suggestions:</strong> As users type, suggests relevant products based on their partial query.<br><strong>Faceted search:</strong> Users can filter products by price, brand, color, size, and other attributes.<br><strong>Personalized recommendations:</strong> Recommends products based on user purchase history, browsing behavior, and similar user preferences.<br><strong>Geolocation search:</strong> Search for products available in specific locations.<br><strong><em>Examples: Amazon, eBay, Alibaba, any e-commerce platform with a large product catalog.</em></strong></p><p><strong>3. Security Analytics:</strong></p><p><strong>Log ingestion and analysis:</strong> Collects and analyzes security logs from various sources like firewalls, network devices, and applications.<br><strong>Threat detection:</strong> Identifies potential security threats by analyzing logs for anomalous patterns and suspicious activity.<br><strong>Compliance reporting:</strong> Generates reports to comply with security regulations and audit requirements.<br><strong>Real-time monitoring:</strong> Provides real-time insights into security threats and alerts security teams of potential breaches.<br>User activity monitoring: Tracks user activity and identifies suspicious behavior to prevent fraud and data breaches.<br><strong><em>Examples: SIEM (Security Information and Event Management) platforms, security operations centers, compliance monitoring systems.</em></strong></p><p><strong>4. Social Media Analytics:</strong></p><p><strong>Social media data ingestion:</strong> Collects data from social media platforms like tweets, posts, and comments.<br><strong>Sentiment analysis:</strong> Analyzes the sentiment of social media content to understand public opinion and brand perception.<br><strong>Trend tracking:</strong> Identifies trending topics and hashtags to stay ahead of the curve.<br><strong>Influence analysis:</strong> Identifies key influencers and analyzes their reach and engagement.<br><strong>Customer feedback analysis:</strong> Analyzes customer feedback on social media to improve products and services.<br><strong><em>Examples: Marketing research, brand monitoring tools, social media listening platforms, customer service teams.</em></strong></p><p><strong><em>Finally…</em></strong>😮‍💨🫨 Baki topics next blog mein…😉</p><p><a href="https://medium.com/@khushimalhoz/node-cluster-document-shards-index-and-replicas-c1f665375dcf"><strong>For more in-depth discussions on Elasticsearch, be sure to check out my upcoming blog post. Node, Cluster, Document, Shards, Index and Replicas?🫨</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b90337a4469" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>