elastic_search_the_definitive_guide.pdf

(6156 KB) Pobierz
Elasticsearch
A DISTRIBUTED REAL-TIME SEARCH AND ANALYTICS ENGINE
The Definitive Guide
Clinton Gormley &
Zachary Tong
Elasticsearch: The Definitive Guide
Whether you need full-text search or real-time analytics of structured data—
or both—the Elasticsearch distributed search engine is an ideal way to put
your data to work. This practical guide not only shows you how to search,
analyze, and explore data with Elasticsearch, but also helps you deal with the
complexities of human language, geolocation, and relationships.
If you’re a newcomer to both search and distributed systems, you’ll
quickly learn how to integrate Elasticsearch into your application. More
experienced users will pick up lots of advanced techniques. Throughout
the book, you’ll follow a problem-based approach to learn why, when, and
how to use Elasticsearch features.
The book could easily be
retitled as 'Understanding
search engines using
Elasticsearch.' Great job.
Way beyond just simply
using Elasticsearch.
Search Consultant
—Ivan Brusic
Understand how Elasticsearch interprets data in your
documents
Index and query your data to take advantage of search
concepts such as relevance and word proximity
Handle human language through the effective use of analyzers
and queries
Summarize and group data to show overall trends, with
aggregations and analytics
Use geo-points and geo-shapes—Elasticsearch’s approaches
to geolocation
Model your data to take advantage of Elasticsearch’s horizontal
scalability
Learn how to configure and monitor your cluster in production
Clinton Gormley
was the first user of Elasticsearch and wrote the Perl API back
in 2010. When Elasticsearch formed a company in 2012, he joined as a developer
and the maintainer of the Perl modules.
Zachary Tong
has been working with Elasticsearch since 2011, and has written
several tutorials to help beginners using the server. Zach is a developer at
Elasticsearch and maintains the PHP client.
DATABA SES/ WEB
Twitter: @oreillymedia
facebook.com/oreilly
CAN $57.99
US $49.99
ISBN: 978-1-449-35854-9
Elasticsearch: The Definitive Guide
Clinton Gormley and Zachary Tong
Elasticsearch: The Definitive Guide
by Clinton Gormley and Zachary Tong
Copyright © 2015 Elasticsearch. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors:
Mike Loukides and Brian Anderson
Production Editor:
Shiny Kalapurakkel
Proofreader:
Sharon Wilkey
Indexer:
Ellen Troutman-Zaig
January 2015:
First Edition
Interior Designer:
David Futato
Cover Designer:
Ellie Volkhausen
Illustrator:
Rebecca Demarest
Revision History for the First Edition
2015-01-16:
First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449358549
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Elasticsearch: The Definitive Guide,
the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-449-35854-9
[LSI]
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Part I.
Getting Started
4
5
5
6
6
6
7
9
9
10
10
10
12
13
15
16
17
18
19
20
23
iii
1. You Know, for Search…. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing Elasticsearch
Installing Marvel
Running Elasticsearch
Viewing Marvel and Sense
Talking to Elasticsearch
Java API
RESTful API with JSON over HTTP
Document Oriented
JSON
Finding Your Feet
Let’s Build an Employee Directory
Indexing Employee Documents
Retrieving a Document
Search Lite
Search with Query DSL
More-Complicated Searches
Full-Text Search
Phrase Search
Highlighting Our Searches
Analytics
Tutorial Conclusion
Zgłoś jeśli naruszono regulamin