Book Image

ElasticSearch Blueprints

Book Image

ElasticSearch Blueprints

Overview of this book

Table of Contents (15 chapters)
Elasticsearch Blueprints
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

Elasticsearch is a distributed search server similar to Apache Solr with a focus on large datasets, schemaless setup, and high availability. Utilizing the Apache Lucene library (also used in Apache Solr), Elasticsearch enables powerful full-text searches, autocomplete, the "morelikethis" search, multilingual functionality, as well as an extensive search query DSL.

Elasticsearch's schemafree architecture provides developers with built-in flexibility as well as ease of setup. This architecture allows Elasticsearch to index and search unstructured content, making it perfectly suited for both small projects and large big data warehouses—even with petabytes of unstructured data.

This book will enable you to utilize the amazing features of Elasticsearch and build projects to simplify operations on even large datasets. This book starts with the creation of a Google-like web search service, enabling you to generate your own search results. You will then learn how an e-commerce website can be built using Elasticsearch, which will help users search and narrow down the set of products they are interested in. You will explore the most important part of a search—relevancy—based on the various parameters, such as relevance, document collection relevance, user usage pattern, geographic nearness, and document relevance to select the top results.

Next, you will discover how Elasticsearch manages relational content for even complex real-world data. You will then learn the capabilities of Elasticsearch as a strong analytic search platform, which coupled with some visualization techniques can produce real-time data visualization. You will also discover how to improve your search quality and widen the scope of matches using various analyzer techniques. Finally, this book will cover the various geo capabilities of Elasticsearch to make your searches similar to real-world scenarios.

What this book covers

Chapter 1, Google-like Web Search, takes you along the course of building a simple scalable search server. You will learn how to create an index and add some documents to it and you will try out some essential features, such as highlighting and pagination of results. Also, it will cover topics such as setting an analyzer for our text; applying filters to eliminate unwanted characters, such as HTML tags; and so on.

Chapter 2, Building Your Own E-Commerce Solution, covers how to design a scalable e-commerce search solution to generate accurate search results using various filters, such as date-range based and prize-range based filters.

Chapter 3, Relevancy and Scoring, unleashes the power and flexibility of Elasticsearch that will help you implement your own scoring logic.

Chapter 4, Managing Relational Content, covers how to use the document linking or relational features of Elasticsearch.

Chapter 5, Analytics Using Elasticsearch, covers the capability and usage of Elasticsearch in the analytics area with a few use case scenarios.

Chapter 6, Improving the Search Experience, helps you learn how to improve the search quality of a text search. This includes the description of various analyzers and a detailed description of how to mix and match them.

Chapter 7, Spicing Up a Search Using Geo, explores how to use geo information to get the best out of search and scoring.

Chapter 8, Handling Time-based Data, explains the difficulties we face when we use normal indexing in Elasticsearch.

What you need for this book

You will need the following tools to build the projects and execute the queries in this book:

  • cURL: cURL is an open source command-line tool available in both Windows and Unix. It is widely used to communicate with web interfaces. Since all communication to Elasticsearch can be done through standard REST protocols, we will use cURL throughout the book to communicate with Elasticsearch. The official site for cURL is http://curl.haxx.se/download.html.

  • Elasticsearch: You need to install Elasticsearch from its official site, http://www.elasticsearch.org/. When this book was written, the latest Elasticsearch version available was 1.0.0, so I would recommend that you use this one. The only dependency of Elasticsearch is Java 1.6 or its higher versions. Once you make sure you have installed Java, download the Elasticsearch ZIP file, the installation instructions for which are mentioned in Chapter 1, Google-like Web Search.

Who this book is for

If you are a developer who has good practical experience in Elasticsearch, Lucene, or Solr and want to know how to implement Elasticsearch in real-world scenarios, then this book is for you.

Conventions

In this book, you will find a number of text styles 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: "Note that for most of the fields that have a string value, such as sex, purposeOfVisit, and so on, we add the not_analyzed field type definition."

A block of code is set as follows:

curl -X PUT "http://$hostname:9200/planeticketing" -d '{
        "index": {
            "number_of_shards": 2,
            "number_of_replicas": 1
        }
    }'

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

          "query": "nausea fever"
        }
      },
      "negative": {
        "multi_match": {
          "fields": [
            "title",
            "content"
          ],

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

curl -XPOST 'http://localhost:9200/wiki/articles/' -d @India.json

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Now, take the Browser tab in the head UI."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in 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 at 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 from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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 could 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 to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.