Defining the structure of data is one of the key things to getting the search speed right, as well as making updates easier and non-expensive. If we compare it to the SQL world, most of the NoSQL solutions fail to provide relational mappings and queries. Elasticsearch, in spite of being a NoSQL document store, provides some ways to manage this relational data. However, there are always some trade-offs which we must be aware of before choosing a solution for defining the schema of the index. There are primarily four ways to define document structure in Elasticsearch:
Flat structure (application side joins)
Flat structures, In flat structures, we index the documents in simple key-value pairs or sometimes in the form of plain objects; these are the simplest and fastest ones. Storing data in this format allows for faster indexing as well as faster query execution. But it is hard to maintain the...