![]()
Elasticsearch Server Third Edition
Table of Contents
Elasticsearch Server Third Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with Elasticsearch Cluster
Full text searching
The Lucene glossary and architecture
Input data analysis
Indexing and querying
Scoring and query relevance
The basics of Elasticsearch
Key concepts of Elasticsearch
Index
Document
Document type
Mapping
Key concepts of the Elasticsearch infrastructure
Nodes and clusters
Shards
Replicas
Gateway
Indexing and searching
Installing and configuring your cluster
Installing Java
Installing Elasticsearch
Running Elasticsearch
Shutting down Elasticsearch
The directory layout
Configuring Elasticsearch
The system-specific installation and configuration
Installing Elasticsearch on Linux
Installing Elasticsearch using RPM packages
Installing Elasticsearch using the DEB package
Elasticsearch configuration file localization
Configuring Elasticsearch as a system service on Linux
Elasticsearch as a system service on Windows
Manipulating data with the REST API
Understanding the REST API
Storing data in Elasticsearch
Creating a new document
Automatic identifier creation
Retrieving documents
Updating documents
Dealing with non-existing documents
Adding partial documents
Deleting documents
Versioning
Usage example
Versioning from external systems
Searching with the URI request query
Sample data
URI search
Elasticsearch query response
Query analysis
URI query string parameters
The query
The default search field
Analyzer
The default operator property
Query explanation
The fields returned
Sorting the results
The search timeout
The results window
Limiting per-shard results
Ignoring unavailable indices
The search type
Lowercasing term expansion
Wildcard and prefix analysis
Lucene query syntax
Summary
2. Indexing Your Data
Elasticsearch indexing
Shards and replicas
Write consistency
Creating indices
Altering automatic index creation
Settings for a newly created index
Index deletion
Mappings configuration
Type determining mechanism
Disabling the type determining mechanism
Tuning the type determining mechanism for numeric types
Tuning the type determining mechanism for dates
Index structure mapping
Type and types definition
Fields
Core types
Common attributes
String
Number
Boolean
Binary
Date
Multi fields
The IP address type
Token count type
Using analyzers
Out-of-the-box analyzers
Defining your own analyzers
Default analyzers
Different similarity models
Setting per-field similarity
Available similarity models
Configuring default similarity
Configuring BM25 similarity
Configuring DFR similarity
Configuring IB similarity
Batch indexing to speed up your indexing process
Preparing data for bulk indexing
Indexing the data
The _all field
The _source field
Additional internal fields
Introduction to segment merging
Segment merging
The need for segment merging
The merge policy
The merge scheduler
Throttling
Introduction to routing
Default indexing
Default searching
Routing
The routing parameters
Routing fields
Summary
3. Searching Your Data
Querying Elasticsearch
The example data
A simple query
Paging and result size
Returning the version value
Limiting the score
Choosing the fields that we want to return
Source filtering
Using the script fields
Passing parameters to the script fields
Understanding the querying process
Query logic
Search type
Search execution preference
Search shards API
Basic queries
The term query
The terms query
The match all query
The type query
The exists query
The missing query
The common terms query
The match query
The Boolean match query
The phrase match query
The match phrase prefix query
The multi match query
The query string query
Running the query string query against multiple fields
The simple query string query
The identifiers query
The prefix query
The fuzzy query
The wildcard query
The range query
Regular expression query
The more like this query
Compound queries
The bool query
The dis_max query
The boosting query
The constant_score query
The indices query
Using span queries
A span
Span term query
Span first query
Span near query
Span or query
Span not query
Span within query
Span containing query
Span multi query
Performance considerations
Choosing the right query
The use cases
Limiting results to given tags
Searching for values in a range
Boosting some of the matched documents
Ignoring lower scoring partial queries
Using Lucene query syntax in queries
Handling user queries without errors
Autocomplete using prefixes
Finding terms similar to a given one
Matching phrases
Spans, spans everywhere
Summary
4. Extending Your Querying Knowledge
Filtering your results
The context is the key
Explicit filtering with bool query
Highlighting
Getting started with highlighting
Field configuration
Under the hood
Forcing highlighter type
Configuring HTML tags
Controlling highlighted fragments
Global and local settings
Require matching
Custom highlighting query
The Postings highlighter
Validating your queries
Using the Validate API
Sorting data
Default sorting
Selecting fields used for sorting
Sorting mode
Specifying behavior for missing fields
Dynamic criteria
Calculate scoring when sorting
Query rewrite
Prefix query as an example
Getting back to Apache Lucene
Query rewrite properties
Summary
5. Extending Your Index Structure
Indexing tree-like structures
Data structure
Analysis
Indexing data that is not flat
Data
Objects
Arrays
Mappings
Final mappings
Sending the mappings to Elasticsearch
To be or not to be dynamic
Disabling object indexing
Using nested object...