Book Image

Elasticsearch Server: Second Edition

Book Image

Elasticsearch Server: Second Edition

Overview of this book

Table of Contents (18 chapters)
Elasticsearch Server Second Edition
Credits
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Welcome to Elasticsearch Server Second Edition. In the second edition of the book, we decided not only to do the update to match the latest version of Elasticsearch but also to add some additional important sections that we didn't think of while writing the first book. While reading this book, you will be taken on a journey through a wonderful world of full-text search provided by the Elasticsearch server. We will start with a general introduction to Elasticsearch, which covers how to start and run Elasticsearch, what are the basic concepts of Elasticsearch, and how to index and search your data in the most basic way.

This book will also discuss the query language, so-called Querydsl, that allows you to create complicated queries and filter the returned results. In addition to all this, you'll see how you can use faceting to calculate aggregated data based on the results returned by your queries, and how to use the newly introduced aggregation framework (the analytics engine allows you to give meaning to your data). We will implement autocomplete functionality together and learn how to use Elasticsearch spatial capabilities and prospective search.

Finally, this book will show you Elasticsearch administration API capabilities with features such as shard placement control and cluster handling.

What this book covers

Chapter 1, Getting Started with the Elasticsearch Cluster, covers what full-text searching, Apache Lucene, and text analysis are, how to run and configure Elasticsearch, and finally, how to index and search your data in the most basic way.

Chapter 2, Indexing Your Data, shows how indexing works, how to prepare an index structure and what data types we are allowed to use, how to speed up indexing, what segments are, how merging works, and what routing is.

Chapter 3, Searching Your Data, introduces the full-text search capabilities of Elasticsearch by discussing how to query, how the querying process works, and what type of basic and compound queries are available. In addition to this, we will learn how to filter our results, use highlighting, and modify the sorting of returned results.

Chapter 4, Extending Your Index Structure, discusses how to index more complex data structures. We will learn how to index tree-like data types, index data with relationships between documents, and modify the structure of an index.

Chapter 5, Make Your Search Better, covers Apache Lucene scoring and how to influence it in Elasticsearch, the scripting capabilities of Elasticsearch, and language analysis.

Chapter 6, Beyond Full-text Searching, shows the details of the aggregation framework functionality, faceting, and how to implement spellchecking and autocomplete using Elasticsearch. In addition to this, readers will learn how to index binary files, work with geospatial data, and efficiently process large datasets.

Chapter 7, Elasticsearch Cluster in Detail, discusses the nodes discovery mechanism, recovery and gateway Elasticsearch modules, templates and cluster preparation for high indexing, and querying use cases.

Chapter 8, Administrating Your Cluster, covers the Elasticsearch backup functionality, cluster monitoring, rebalancing, and moving shards. In addition to this, you will learn how to use the warm-up functionality, work with aliases, install plugins, and update cluster settings with the update API.

What you need for this book

This book was written using Elasticsearch server Version 1.0.0, and all the examples and functions should work with it. In addition to this, you'll need a command that allows you to send HTTP requests such as cURL, which is available for most operating systems. Please note that all the examples in this book use the mentioned cURL tool. If you want to use another tool, please remember to format the request in an appropriate way that can be understood by the tool of your choice.

In addition to this, some chapters may require additional software such as Elasticsearch plugins, but it has been explicitly mentioned when certain types of software are needed.

Who this book is for

If you are a beginner to the world of full-text search and Elasticsearch, this book is for you. You will be guided through the basics of Elasticsearch, and you will learn how to use some of the advanced functionalities.

If you know Elasticsearch and have worked with it, you may find this book interesting as it provides a nice overview of all the functionalities with examples and description.

If you know the Apache Solr search engine, this book can also be used to compare some functionalities of Apache Solr and Elasticsearch. This may give you the knowledge about the tool, which is more appropriate for your use.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows:

"The postings format is a per-field property, just like type or name."

A block of code is set as follows:

{
  "status" : 200,
  "name" : "es_server",
  "version" : {
    "number" : "1.0.0",
    "build_hash" : "a46900e9c72c0a623d71b54016357d5f94c8ea32",
    "build_timestamp" : "2014-02-12T16:18:34Z",
    "build_snapshot" : false,
    "lucene_version" : "4.6"
  },
  "tagline" : "You Know, for Search"
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

{
  "mappings" : {
    "post" : {
      "properties" : {
        "id" : { "type" : "long", "store" : "yes", "precision_step" : "0" },
        "name" : { "type" : "string", "store" : "yes", "index" : "analyzed", "similarity" : "BM25" },
        "contents" : { "type" : "string", "store" : "no", "index" : "analyzed", "similarity" : "BM25" }
      }
    }
  }
}

Any command-line input or output is written as follows:

curl -XGET http://localhost:9200/blog/article/1

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.