Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Elasticsearch Server - Third Edition
Elasticsearch Server - Third Edition

Elasticsearch Server - Third Edition: Leverage Elasticsearch to create a robust, fast, and flexible search solution with ease , Third Edition

Arrow left icon
Profile Icon Marek Rogozinski Profile Icon Rafal Kuc
Arrow right icon
S$45.99 S$65.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Feb 2016 556 pages 3rd Edition
eBook
S$45.99 S$65.99
Paperback
S$82.99
Subscription
Free Trial
Arrow left icon
Profile Icon Marek Rogozinski Profile Icon Rafal Kuc
Arrow right icon
S$45.99 S$65.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Feb 2016 556 pages 3rd Edition
eBook
S$45.99 S$65.99
Paperback
S$82.99
Subscription
Free Trial
eBook
S$45.99 S$65.99
Paperback
S$82.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Elasticsearch Server - Third Edition

Chapter 2. Indexing Your Data

In the previous chapter, we learned what full text search is and how Apache Lucene fits there. We were introduced to the basic concepts of Elasticsearch and we are now familiar with its top-level architecture, so we know how it works. We used the REST API to index data, to update it, to delete it, and of course to retrieve it. We searched our data with the simple URI query and we used versioning that allowed us to use optimistic locking functionality. By the end of this chapter, you will have learned the following topics:

  • Basic information about Elasticsearch indexing
  • Adjusting Elasticsearch schema-less behavior
  • Creating your own mappings
  • Using out of the box analyzers
  • Configuring your own analyzers
  • Index data in batches
  • Adding additional internal information to indices
  • Segment merging
  • Routing

Elasticsearch indexing

So far we have our Elasticsearch cluster up and running. We also know how to use Elasticsearch REST API to index our data, we know how to retrieve it, and we also know how to remove the data that we no longer need. We've also learned how to search in our data by using the URI request search and Apache Lucene query language. However, until now we've used Elasticsearch functionality that allows us not to care about indices, shards, and data structure. This is not something that you may be used to when you are coming from the world of SQL databases, where you need the database and the tables with all the columns created upfront. In general, you needed to describe the data structure to be able to put data into the database. Elasticsearch is schema-less and by default creates indices automatically and because of that we can just install it and index data without the need of any preparations. However, this is usually not the best situation when it comes to production...

Mappings configuration

If you are used to SQL databases, you may know that before you can start inserting the data in the database, you need to create a schema, which will describe what your data looks like. Although Elasticsearch is a schema-less (we rather call it data driven schema) search engine and can figure out the data structure on the fly, we think that controlling the structure and thus defining it ourselves is a better way. The field type determining mechanism is not going to guess the future. For example, if you first send an integer value, such as 60, and you send a float value such as 70.23 for the same field, an error can happen or Elasticsearch will just cut off the decimal part of the float value (which is actually what happens). This is because Elasticsearch will first set the field type to integer and will try to index the float value to the integer field which will cause cutting of the decimal point in the floating point number. In the next few pages you'll see...

Batch indexing to speed up your indexing process

In Chapter 1, Getting Started with Elasticsearch Cluster, we saw how to index a particular document into Elasticsearch. It required opening an HTTP connection, sending the document, and closing the connection. Of course, we were not responsible for most of that as we used the curl command, but in the background this is what happened. However, sending the documents one by one is not efficient. Because of that, it is now time to find out how to index a large number of documents in a more convenient and efficient way than doing so one by one.

Preparing data for bulk indexing

Elasticsearch allows us to merge many requests into one package. This package can be sent as a single request. What's more, we are not limited to having a single type of request in the so called bulk – we can mix different types of operations together, which include:

  • Adding or replacing the existing documents in the index (index)
  • Removing documents from the index...

Introduction to segment merging

In the Full text searching section of Chapter 1, Getting Started with Elasticsearch Cluster, we mentioned segments and their immutability. We wrote that the Lucene library, and thus Elasticsearch, writes data to certain structures that are written once and never change. This allows for some simplification, but also introduces the need for additional work. One such example is deletion. Because segment, cannot be altered, information about deletions must be stored alongside and dynamically applied during search. This is done by filtering deleted documents from the returned result set. The other example is the inability to modify the documents (however, some modifications are possible, such as modifying numeric doc values). Of course, one can say that Elasticsearch supports document updates (refer to the Manipulating data with the REST API section of Chapter 1, Getting Started with Elasticsearch Cluster). However, under the hood, the old document is marked as...

Introduction to routing

By default, Elasticsearch will try to distribute your documents evenly among all the shards of the index. However, that's not always the desired situation. In order to retrieve the documents, Elasticsearch must query all the shards and merge the results. What if we could divide our data on some basis (for example, the client identifier) and use that information to put data with the same properties in the same place in the cluster. Elasticsearch allows us to do that by exposing a powerful document and query distribution control mechanism routing. In short, it allows us to choose a shard to be used to index or search the data.

Default indexing

During indexing operations, when you send a document for indexing, Elasticsearch looks at its identifier to choose the shard in which the document should be indexed. By default, Elasticsearch calculates the hash value of the document's identifier and, on the basis of that, it puts the document in one of the available...

Elasticsearch indexing


So far we have our Elasticsearch cluster up and running. We also know how to use Elasticsearch REST API to index our data, we know how to retrieve it, and we also know how to remove the data that we no longer need. We've also learned how to search in our data by using the URI request search and Apache Lucene query language. However, until now we've used Elasticsearch functionality that allows us not to care about indices, shards, and data structure. This is not something that you may be used to when you are coming from the world of SQL databases, where you need the database and the tables with all the columns created upfront. In general, you needed to describe the data structure to be able to put data into the database. Elasticsearch is schema-less and by default creates indices automatically and because of that we can just install it and index data without the need of any preparations. However, this is usually not the best situation when it comes to production environments...

Left arrow icon Right arrow icon

Key benefits

  • Boost the searching capabilities of your system through synonyms, multilingual data handling, nested objects and parent-child documents
  • Deep dive into the world of data aggregation and data analysis with ElasticSearch
  • Explore a wide range of ElasticSearch modules that define the behavior of a cluster

Description

ElasticSearch is a very fast and scalable open source search engine, designed with distribution and cloud in mind, complete with all the goodies that Apache Lucene has to offer. ElasticSearch’s schema-free architecture allows developers to index and search unstructured content, making it perfectly suited for both small projects and large big data warehouses, even those with petabytes of unstructured data. This book will guide you through the world of the most commonly used ElasticSearch server functionalities. You’ll start off by getting an understanding of the basics of ElasticSearch and its data indexing functionality. Next, you will see the querying capabilities of ElasticSearch, followed by a through explanation of scoring and search relevance. After this, you will explore the aggregation and data analysis capabilities of ElasticSearch and will learn how cluster administration and scaling can be used to boost your application performance. You’ll find out how to use the friendly REST APIs and how to tune ElasticSearch to make the most of it. By the end of this book, you will have be able to create amazing search solutions as per your project’s specifications.

Who is this book for?

If you are a competent developer and want to learn about the great and exciting world of ElasticSearch, then this book is for you. No prior knowledge of Java or Apache Lucene is needed.

What you will learn

  • Configure, create, and retrieve data from your indices
  • Use an ElasticSearch query DSL to create a wide range of queries
  • Discover the highlighting and geographical search features offered by ElasticSearch
  • Find out how to index data that is not flat or data that has a relationship
  • Exploit a prospective search to search for queries not documents
  • Use the aggregations framework to get more from your data and improve your client's search experience
  • Monitor your cluster state and health using the ElasticSearch API as well as third-party monitoring solutions
  • Discover how to properly set up ElasticSearch for various use cases

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 29, 2016
Length: 556 pages
Edition : 3rd
Language : English
ISBN-13 : 9781785883620
Vendor :
Elastic
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 29, 2016
Length: 556 pages
Edition : 3rd
Language : English
ISBN-13 : 9781785883620
Vendor :
Elastic
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total S$ 179.97
Elasticsearch Essentials
S$59.99
Elasticsearch  Indexing
S$36.99
Elasticsearch Server - Third Edition
S$82.99
Total S$ 179.97 Stars icon
Banner background image

Table of Contents

12 Chapters
1. Getting Started with Elasticsearch Cluster Chevron down icon Chevron up icon
2. Indexing Your Data Chevron down icon Chevron up icon
3. Searching Your Data Chevron down icon Chevron up icon
4. Extending Your Querying Knowledge Chevron down icon Chevron up icon
5. Extending Your Index Structure Chevron down icon Chevron up icon
6. Make Your Search Better Chevron down icon Chevron up icon
7. Aggregations for Data Analysis Chevron down icon Chevron up icon
8. Beyond Full-text Searching Chevron down icon Chevron up icon
9. Elasticsearch Cluster in Detail Chevron down icon Chevron up icon
10. Administrating Your Cluster Chevron down icon Chevron up icon
11. Scaling by Example Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Amazon Customer Jul 19, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Well explanation...
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.