Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Elasticsearch Server: Second Edition

You're reading from  Elasticsearch Server: Second Edition

Product type Book
Published in Apr 2014
Publisher
ISBN-13 9781783980529
Pages 428 pages
Edition 1st Edition
Languages

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
Getting Started with the Elasticsearch Cluster Indexing Your Data Searching Your Data Extending Your Index Structure Make Your Search Better Beyond Full-text Searching Elasticsearch Cluster in Detail Administrating Your Cluster Index

Basic queries


Elasticsearch has extensive search and data analysis capabilities that are exposed in the form of different queries, filters, and aggregates, and so on. In this section, we will concentrate on the basic queries provided by Elasticsearch.

The term query

The term query is one of the simplest queries in Elasticsearch. It just matches the document that has a term in a given field—the exact, not analyzed term. The simplest term query is as follows:

{
  "query" : {
    "term" : {
      "title" : "crime"
    }
  }
}

The preceding query will match the documents that have the crime term in the title field. Remember that the term query is not analyzed, so you need to provide the exact term that will match the term in the indexed document. Please note that in our input data, we have the title field with the Crime and Punishment term, but we are searching for crime because the Crime term becomes crime after analysis during indexing.

In addition to the term we want to find, we can also include...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}