Learning
Elasticsearch 7.x
Index, Analyze, Search and
Aggregate Your Data Using Elasticsearch
Anurag Srivastava
www.bpbonline.com
FIRST EDITION 2021
Copyright BPB Publications, India
ISBN: 978-93-89898-309
All Rights Reserved. No part of this publication may be reproduced, distributed or transmitted in any form or by any means or stored in a database or retrieval system, without the prior written permission of the publisher with the exception to the program listings which may be entered, stored and executed in a computer system, but they can not be reproduced by the means of publication, photocopy, recording, or by any electronic and mechanical means.
LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
The information contained in this book is true to correct and the best of authors and publishers knowledge. The author has made every effort to ensure the accuracy of these publications, but publisher cannot be held responsible for any loss or damage arising from any information in this book.
All trademarks referred to in the book are acknowledged as properties of their respective owners but BPB Publications cannot guarantee the accuracy of this information.
Distributors:
BPB PUBLICATIONS
20, Ansari Road, Darya Ganj
New Delhi-110002
Ph: 23254990/23254991
MICRO MEDIA
Shop No. 5, Mahendra Chambers,
DN Rd. Next to Capital Cinema,
V.T. (C.S.T.) Station, MUMBAI-400
Ph: 22078296/22078297
DECCAN AGENCIES
4-3-329, Bank Street,
Hyderabad-500195
Ph: 24756967/24756400
BPB BOOK CENTRE
Old Lajpat Rai Market,
Delhi-110006
Ph: 23861747
Published by Manish Jain for BPB Publications, Ansari Road, Darya Ganj, New Delhi-110002 and Printed by him at Repro India Ltd, Mumbai
www.bpbonline.com
Dedicated to
My beloved parents
Shri Virendra Nath Srivastava
Shrimati Kiran Srivastava
&
My wife Chanchal and son Anvit
About the Author
Anurag Srivastava is works as Deputy Manager in the R&D centre of an air conditioning company. He has over years of experience in the software industry and has led and handled teams and clients for more than years. He is proficient in designing and deploying scalable applications and has multiple certifications in ML and data science using Python. He is well experienced with the Elastic stack (Elasticsearch, Logstash, and Kibana) for creating dashboards using system metrics data, log data, application data, or relational databases. Plus, he has good experience in some CI/CD and monitoring tools, like Jenkins, SonarQube, Graylog, and Kibana.
About the Reviewer
Pankaj has over years of experience of working on front-end technologies like Angular, React, and EmberJS and currently works at Deskera as a senior software engineer. His skills in Angular and web application development, and more, have seen him become a Microsoft MVP and Google developer expert. Pankaj loves to share his knowledge with the community by speaking at various technical events and conferences. He is also the top contributor on stack overflow in India, and he ranks among the top contributors in the world on Angular and AngularJS. He is also a technical reviewer for BPB Publication. He now focuses on channeling his knowledge into open-source projects and sharing it with the community by mentoring, creating POCS, running workshops, and writing blogs to help boost development in the world.
Acknowledgement
There are a few people I want to thank for their continued and ongoing support during the writing of this book. First and foremost, I would like to thank my wife for continuously encouraging me to write the book I could have never completed it without her support.
I would also like to mention my parents, who have always supported me with all my assignments and trusted me throughout, giving me the confidence to complete this book.
My gratitude also goes to the team at BPB Publication for being supportive enough to provide me enough time to finish the book. They have supported me by providing me with feedback and incorporating my inputs.
Preface
This book is for developers, architects, DBA, DevOps, and other readers who want to learn Elasticsearch efficiently and apply it in their new/existing application. It is also beneficial to those who want to play with their data using Elasticsearch.
Basic computer programming is a perquisite, but no prior knowledge of Elasticsearch is required. required before starting this book as in this book we have covered Elasticsearch along with an introduction to other tools of Elastic Stack.
No prior knowledge of Elasticsearch is required before starting this book as this book starts from very basic and then goes to a very advanced topic gradually and practically through which anyone can easily understand the concepts.
This book has eleven chapters, in which you will learn the following:
Chapter provides an overview of Elasticsearch and its components like cluster, nodes, index, document, and shard, and it also provides different use cases of Elasticsearch.
Chapter covers the installation process of Elasticsearch. Here, we will talk about whats new in Elasticsearch 7.x, and then we will look at Elasticsearch installation on Linux using RPM, Debian package, macOS, and Windows.
Chapter provides an introduction to Elastic Stack, where we will learn about Beats, Logstash, and Kibana. We will talk about the different components of Elastic Stack, that is, Elasticsearch, Logstash, Kibana, Beats, and such. We will also explain how each component works.
Chapter looks at how to prepare the data before indexing. Here, we will cover different types of analyzers, normalizers, tokenizers, token filters and, character filters in Elasticsearch. We will also explain why it is important to prepare the data before indexing.
Chapter walks you through how to import data from different sources into Elasticsearch. We will also discuss why data is so important for businesses and explain how to import data into Elasticsearch using different Beats and from different sources using Logstash.
Chapter is about Elasticsearch index management. It explains how to create index, along with mapping. We will also perform index level operations and look at index APIs and the index life-cycle management.
Chapter helps you understand the different search queries and how to construct the query for different use cases. We will cover the URI search and request body searches. We will also cover different APIs like multi search API, explain API, and profile API.