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

Chapter 4. Managing Relational Content

Representing real-world data is very decisive in the sense that usually, straight data structures won't always suffice for your needs. Often, you would find yourself in a position where you would need to adopt a complex structure for your data with some kind of a relation within objects. Here, in this chapter, we will see how Elasticsearch provides provisions to manage such relational content. Here are the topics that we will cover in this chapter:

  • Parent-child search

  • Limitations on a query on nested fields

  • Solution 1 – nested datatype

  • Solution 2– parent-child datatype

  • Schema design to store questions and answers

  • Searching questions based on a criteria of answers

  • Searching answers based on a criteria of questions

  • Term lookup

Elasticsearch provides a number of ways with which you can manage relational content. Of those, the simplest way is to directly add inner objects within your structure. Let's see how simple inner objects in Elasticsearch behave.