# Need suggestions on creation of an index for specific use-case

**URL:** <https://discuss.elastic.co/t/need-suggestions-on-creation-of-an-index-for-specific-use-case/25396>\
**Category:** Elasticsearch\
**Created:** [July 12, 2015, 5:25pm UTC](https://discuss.elastic.co/t/need-suggestions-on-creation-of-an-index-for-specific-use-case/25396 "2015-07-12T17:25:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apanimesh061](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apanimesh061/32/927_2.png) [@apanimesh061](https://discuss.elastic.co/u/apanimesh061)\
**Post date:** [July 12, 2015, 5:25pm UTC](https://discuss.elastic.co/t/need-suggestions-on-creation-of-an-index-for-specific-use-case/25396/1 "2015-07-12T17:25:11Z")

</div>

I have been using Elasticsearch for quite a while. In nm use case I have document sets denoted by an ID. These sets have documents that are denoted by IDs as well. There is a default mapping that all sets follow. Only difference is that I can add custom analysers to the mappings such that only Document Set has that, all others will remain as it is. I thought of having a `parent-child` settings between sets and documents. I came up with the following but I don't think I will be able to solve my issue as every set will need to have a new mapping even though it might be same:

```
PUT /test_index/
{
  "settings": {
    "index.store.type": "default",
    "index": {
        "number_of_shards": 5,
        "number_of_replicas": 1,
        "refresh_interval": "60s"
    },
    "analysis": {
        "filter": {
            "porter_stemmer_en_EN": {
                "type": "stemmer",
                "name": "porter"
            },
            "default_stop_name_en_EN": {
                "type": "stop",
                "name": "_english_"
            },
            "snowball_stop_words_en_EN": {
                "type": "stop",
                "stopwords_path": "snowball.stop"
            },
            "smart_stop_words_en_EN": {
                "type": "stop",
                "stopwords_path": "smart.stop"
            },
            "shingle_filter_en_EN": {
                "type": "shingle",
                "min_shingle_size": "2",
                "max_shingle_size": "2",
                "output_unigrams": true
            }
        }
    }
  }
}

```

Here is the default mapping that I have:

```
PUT /test_index/document_set/_mapping
{
  "document_set": {
         "properties": {
            "docset_id": {
               "type": "string"
            }
         }
    }
}

PUT /test_index/document/_mapping
{
  "document": {
      "dynamic": "strict",
         "_parent": {
            "type": "document_set"
         },
         "properties": {
            "doc_id": {
               "type": "string"
            },
            "text": {
               "type": "multi_field",
               "fields": {
                 "text": {
                   "type": "string",
                   "store": true,
                   "index": "analyzed"
                 },
                 "pdf": {
                   "type": "attachment",
                   "store": true,
                   "index": "analyzed"
                 }
               }
            }
         }
      }
}

```

Now suppose I create a custom analyzer:

```
"analyzer": {
                  "shingle_type": {
                     "type": "custom",
                     "filter": [
                        "porter_stemmer_en_EN",
                        "smart_stop_words_en_EN",
                        "shingle_filter_en_EN",
                        "lowercase"
                     ],
                     "tokenizer": "whitespace"
                  }

```

But I want to add it only to some specified `document_set` so that only that set's documents are analyzed by that ,how will I do it?

Any suggestion is welcomed.

---

<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:** [July 6, 2017, 12:02am UTC](https://discuss.elastic.co/t/need-suggestions-on-creation-of-an-index-for-specific-use-case/25396/2 "2017-07-06T00:02:01Z")

</div>


