Understand Lucene to Understand ElasticSearch

栏目: IT技术 · 发布时间: 4年前

内容简介:The purpose of this article is to promote a better understanding of how things work within ElasticSearch. If you are reading this article, you probably already know how ElasticSearch works, if that is not true, you can learn a little more by reading the fo

The purpose of this article is to promote a better understanding of how things work within ElasticSearch. If you are reading this article, you probably already know how ElasticSearch works, if that is not true, you can learn a little more by reading the following article:

Lucene.

Lucene is the base of ElasticSearch, but you don’t interract directly with him, as you drive your car, but you don’t ask direct to your engine to start. But what if your car break, don’t you think is a good idea to know how your engine works?

Lucene Indexing

You have a big a mount of files, and you need to find a specificy file, wich contais a certain word, how to be quickly to do this? how to be scalable? Here’s where indexing comes in: to search large amounts of text quickly, you must first index that text and convert it into a format that will let you search it rapidly. This conversion process is called indexing, and its output is called an index.

Lucene Index.

The index is composed of one or more segments, and each segment is composed of several indexes, confusing, right? When it is created, it is separated into smaller segments, or you can see it as sub-indices, where each index is not completely independent.

Understand Lucene to Understand ElasticSearch

Lucene Segments.

Segments are immutable .Each segment contains one or more Lucene Documents

At some point, on your journey through ES, you have been in the situation of having to delete a document. And apparently that was no problem, but what is going on behind the scenes?

When you delete a document, it is only “marked” as deleted and a new version of the document is added to the segment. Its real execution is only carried out from time to time when a “joining” of larger segments occurs.

In the meantime, documents continue to take up disk space.

Lucene Merge.

Over time the index will accumulate many segments. Periodically, segments are merged into a single new segment and removing the old segments.

But wait, whats it the benefits Merge my segments?

Basically, because two important things, discard old documents and as result reduce our index space on disk, and the second one is the old segments are remove, and a new bigger segment are create, incresing your search speed.

Conclusion

Understand Lunce is essential to understand Elasticsearch, of course are difference beetwen them, but the concept and how things works, is the same. This kind of concepts is hard to find in ElasticSearch documents, because they abstract all this job for you. I hope i can explain some things about the core of Lucene, to show how ElasticSearch trully works.

References and Inspirations:

https://www.manning.com/books/lucene-in-action-second-edition


以上所述就是小编给大家介绍的《Understand Lucene to Understand ElasticSearch》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

免费

免费

[美] 克里斯·安德森 / 蒋旭峰、冯斌、璩静 / 中信出版社 / 2009-9 / 39.00

在《免费:商业的未来 》这本书,克里斯·安德森认为,新型的“免费”并不是一种左口袋出、右口袋进的营销策略,而是一种把货物和服务的成本压低到零的新型卓越能力。在上世纪“免费”是一种强有力的推销手段,而在21世纪它已经成为一种全新的经济模式。 究竟什么是免费商业模式?根据克里斯·安德森的说法,这种新型的“免费”商业模式是一种建立在以电脑字节为基础上的经济学,而非过去建立在物理原子基础上的经济学。......一起来看看 《免费》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具