<?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 Nicolas Peruch on Medium]]></title>
        <description><![CDATA[Stories by Nicolas Peruch on Medium]]></description>
        <link>https://medium.com/@nicolasperuch?source=rss-8eb8e696b704------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q0ApH8KdpDEThwrMcoL_2Q.jpeg</url>
            <title>Stories by Nicolas Peruch on Medium</title>
            <link>https://medium.com/@nicolasperuch?source=rss-8eb8e696b704------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:27:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nicolasperuch/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[Elasticsearch — Index, Type, Fields and Documents!]]></title>
            <link>https://medium.com/@nicolasperuch/elasticsearch-index-type-fields-and-documents-95388d4e8d1e?source=rss-8eb8e696b704------2</link>
            <guid isPermaLink="false">https://medium.com/p/95388d4e8d1e</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Nicolas Peruch]]></dc:creator>
            <pubDate>Wed, 01 Aug 2018 23:59:14 GMT</pubDate>
            <atom:updated>2018-08-01T23:59:14.612Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Folks! today we’re gonna talk about a really basic topic. How elasticsearch organize data in each shard. So, let’s start!</p><h3>Organization</h3><p>Once elasticsearch is up and running, we’ll work with its data, but to do so we need to understand some division made by the tool.</p><h4>Index</h4><p>The simplest explanation to index is compare it to a relational database. Honestly, I’m not a big fan of that but, it helped me understand the concept initially. You can find a rich explanation in the official documentation, clicking the quote bellow.</p><blockquote><a href="https://www.elastic.co/blog/what-is-an-elasticsearch-index">Indices organize data logically, but they also organize data physically through the underlying shards.</a></blockquote><h4>Type</h4><p>Inside each index we have a type! And if you keep going with the relational database comparative, type would be like a table, it’s not that simple though. After version 6.x, elasticsearch only allows you to have 1 type per index. You can read more about that <a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html">here</a>.</p><h4>Field</h4><p>Inside each type we have fields. Field is a property from a data. For example, if you wanna store a car. You will probably need a field to store the car year, another one to its brand, model, etc.</p><h4>Document</h4><p>And last but not least, document is a set of fields carrying values.</p><p>So with that being said, we can think of our Index, Type and Fields more as structural concepts, and Document is a name to represent data alive.</p><p>Ok! once we get that, we need to think about how to organize our own data. Let’s build the following situation.</p><ul><li>We’ll create clans.</li><li>Inside each clan we have several warriors.</li><li>Each character has their own characteristics (name, weapon, damage)</li></ul><h3>Creating an Index</h3><p>In this scenario clan will be an index. Inside the index we have a type, docs and fields.</p><p>To create an index we’ll do a PUT request into “<em>address:port/index</em>”. By default your address must be localhost and port is 9200. As you can see below we have just created an index called “<em>immortals</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*JwYab68OG_F9PFfTyqPFGQ.png" /></figure><p>In the body we added some configurations. We specified how many shards and replicas we want. After that, elasticsearch will distribute those shards/replicas among the nodes.</p><p>Imagine that we have 3 nodes in this situation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*nqOffYEg_aliZDlhFwZDZQ.jpeg" /></figure><p><strong>Immortals index: </strong>So the architecture we’ll be this.</p><blockquote>We can also create an index without worrying about configurations.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*Z7tHuf-IetfD3suLxhudYA.png" /></figure><p>When an index is created without any specified configuration, elasticsearch will create 5 shards and 1 replica of each shard by default.</p><p>Imagine that we have 5 nodes in this situation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*8mHClwPQJMPyy38UsuyL1Q.jpeg" /></figure><p><strong>Astralis index: </strong>So the architecture should be something like this.</p><h3>Adding data</h3><p>Once we have 2 clans we should populate them. To do so, we’ll use the image below as a model.</p><p>Then we add to elasticsearch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*eKVwQ_GIFDsDfCb5INxMlQ.png" /></figure><h3>Breaking down the request</h3><p>After the index (astralis) we put type name (warrior). Inside the body we add name, weapon, and damage. Those guys are our fields and the values of each one of those fields will become a single document once the request is done. But don’t forget! Elasticsearch is schema-less and we can add more fields any time we want.</p><h4>Example:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*z8NUdYTdlf0cp5R39D8DDA.png" /></figure><p>And that’s it for now! Hope you guys enjoy it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95388d4e8d1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elasticsearch — Shall we begin?]]></title>
            <link>https://medium.com/@nicolasperuch/elasticsearch-shall-we-begin-dfb160c4dcdf?source=rss-8eb8e696b704------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfb160c4dcdf</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Nicolas Peruch]]></dc:creator>
            <pubDate>Sun, 22 Apr 2018 01:14:40 GMT</pubDate>
            <atom:updated>2018-06-25T14:35:30.322Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately I have been studying lots of cool things, and I would like to share with you.</p><h3>So what is Elasticsearch?</h3><p>Well, elasticsearch is an open source distributed data analyzer tool based on Apache Lucene (who is a java lib for full text search). It is well known for being an engine search near real time. In others words, imagine that you have a massive input of data which needs to be analyzed, and based on that you are taking actions. First of all, to make these decisions you need to understand what your input is telling you, and this is where elasticsearch shines. And why shouldn’t I just take Lucene do my own business? Well, obviously you can (LOL) but the difference is that Elasticsearch took Lucene , and made it friendly to use using HTTP/JSON. Also, being a distributed system is “easy” to scale. I dare to say that abstraction and scalability are the words for this guy.</p><h3>How does it work?</h3><p>Elasticsearch is basically a cluster with lot of nodes and inside of each node we have a shard (Lucene instance) and a replica. Inside each shard we have an index(a lot of people compare index to a database, I don’t know with it is the best approach but for now lets keep with that) and inside each index we have a type (types are supposed to be a table from Relational DB but types are schemaless!)</p><p>To make things more clearer we can check the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*vjkM_-IdqWfSCaLsNNVm3g.jpeg" /></figure><p>Note that the replica will never be in the same node with the original shard. This is fault tolerance, imagine that node 1 goes down. So with that we do not have shard 1 anymore. But we still have their data alive, because the node 2 is still up and shard 1 replica is running.</p><p>I do not want to write a huge post, so for now that’s all. In the next post, we will talk more about index and types with some basic requests.</p><p>Thanks :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfb160c4dcdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>