# Best practice to create index with common and specific sets of properties per document

**URL:** <https://discuss.elastic.co/t/best-practice-to-create-index-with-common-and-specific-sets-of-properties-per-document/194836>\
**Category:** Elasticsearch\
**Created:** [August 12, 2019, 12:01pm UTC](https://discuss.elastic.co/t/best-practice-to-create-index-with-common-and-specific-sets-of-properties-per-document/194836 "2019-08-12T12:01:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashvydkyi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@ashvydkyi](https://discuss.elastic.co/u/ashvydkyi)\
**Post date:** [August 12, 2019, 12:01pm UTC](https://discuss.elastic.co/t/best-practice-to-create-index-with-common-and-specific-sets-of-properties-per-document/194836/1 "2019-08-12T12:01:44Z")

</div>

Hey guys, can you share the best practices how to create an index to achieve the following structure:

- each document has a common set of properties (type, priority, status)
- each document has a specific set of properties (depending on type)

**The main criteria is a performance.**  
**elasticsearch v6.7**

I have a couple of ideas listed below:

approach#1

```
{
  "settings": {
    "index": {
      "number_of_shards": "6",
      "number_of_replicas": "2"
    }
  },
  "mappings": {
    "event": {
      "properties": {
        "type": {
          "type": "keyword"
        },
        "priority": {
          "type": "keyword"
        },
        "status": {
          "type": "keyword"
        },
        "eventType#1Details": {
          "type": "nested",
          "properties": {
            "eventType#1Detail#1": {
              "type": "boolean"
            },
            "eventType#1Detail#2": {
              "type": "long"
            },
            "eventType#1Detail#3": {
              "type": "keyword"
            }
          }
        },
        "eventType#2Details": {
          "type": "nested",
          "properties": {
            "eventType#2Detail#1": {
              "type": "long"
            },
            "eventType#2Detail#2": {
              "type": "keyword"
            }
          }
        },
        "eventType#3Details": {
          "type": "nested",
          "properties": {
            "eventType#3Detail#1": {
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}

```

approach#2

```
    {
      "settings": {
        "index": {
          "number_of_shards": "6",
          "number_of_replicas": "2"
        }
      },
      "mappings": {
        "event": {
          "properties": {
            "type": {
              "type": "keyword"
            },
            "priority": {
              "type": "keyword"
            },
            "status": {
              "type": "keyword"
            },
            "details": {
              "type": "nested",
              "properties": {
                "eventType#1Detail#1": {
                  "type": "boolean"
                },
                "eventType#1Detail#2": {
                  "type": "long"
                },
                "eventType#1Detail#3": {
                  "type": "keyword"
                },
                "eventType#2Detail#1": {
                  "type": "long"
                },
                "eventType#2Detail#2": {
                  "type": "keyword"
                },
                "eventType#3Detail#1": {
                  "type": "keyword"
                }
              }
            }
          }
        }
      }
    }

```

approach#3

```
{
  "settings": {
    "index": {
      "number_of_shards": "6",
      "number_of_replicas": "2"
    }
  },
  "mappings": {
    "event": {
      "properties": {
        "type": {
          "type": "keyword"
        },
        "priority": {
          "type": "keyword"
        },
        "status": {
          "type": "keyword"
        },
        "eventType#1Detail#1": {
          "type": "boolean"
        },
        "eventType#1Detail#2": {
          "type": "long"
        },
        "eventType#1Detail#3": {
          "type": "keyword"
        },
        "eventType#2Detail#1": {
          "type": "long"
        },
        "eventType#2Detail#2": {
          "type": "keyword"
        },
        "eventType#3Detail#1": {
          "type": "keyword"
        }
      }
    }
  }
}

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 9, 2019, 12:01pm UTC](https://discuss.elastic.co/t/best-practice-to-create-index-with-common-and-specific-sets-of-properties-per-document/194836/2 "2019-09-09T12:01:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
