Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Elasticsearch Server: Second Edition
  • Table Of Contents Toc
Elasticsearch Server: Second Edition

Elasticsearch Server: Second Edition

4.3 (13)
close
close
Elasticsearch Server: Second Edition

Elasticsearch Server: Second Edition

4.3 (13)

Overview of this book

Table of Contents (18 chapters)
close
close
Elasticsearch Server Second Edition
Credits
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1
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...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Elasticsearch Server: Second Edition
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon