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

Implementing a category filter


Normally, the category fields are of the type string. We need to index this unanalyzed field to match the exact term. In fact, Elasticsearch uses a term filter for the purpose of matching strings:

The following snippet shows you how to use a terms filter:

{
    "filtered" : {
        "filter" : {
            "term" : {
                "category" : "Books"
        
            }
        }
    }
}