# Creating an index with mappings and analysis doesn't work

**URL:** <https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048>\
**Category:** Elasticsearch\
**Created:** [January 18, 2018, 12:35pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048 "2018-01-18T12:35:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hayk\_Hovhanisyan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayk_hovhanisyan/32/77342_2.png) [@Hayk\_Hovhanisyan](https://discuss.elastic.co/u/Hayk_Hovhanisyan)\
**Post date:** [January 18, 2018, 12:35pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/1 "2018-01-18T12:35:16Z")

</div>

**_ElasticSearch "2.4.4"_**  
**_Java "1.8.0\_151"_**

Hi folks,

The first example fails with MapperParsingException[Analyzer [bigrams] not found for field [displayName]];.

here is [https://github.com/elastic/elasticsearch/issues/767](https://github.com/elastic/elasticsearch/issues/767) similar closed issues.

But about the case when we are using settings.json in resource and spring data annotations (@Setting(settingPath = "/settings/settings.json") in class level, and @Field(type = FieldType.String, analyzer = "bigrams") for corresponding field) .

```
{  
   "index":{  
      "analysis":{  
         "filter":{  
            "bigrams_filter":{  
               "type":"ngram",
               "min_gram":"2",
               "max_gram":"2"
            }
         },
         "analyzer":{  
            "bigrams":{  
               "type":"custom",
               "tokenizer":"standard",
               "filter":[  
                  "lowercase",
                  "bigrams_filter"
               ]
            }
         }
      }
   }
}

@Setting(settingPath = "/settings/settings.json")
public abstract class AbstractSearchEntity implements Entity {
........
@field(type = FieldType.String, analyzer = "bigrams")
private String displayName;`
..........

}

```

regards Hayk Hovhannisyan

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 18, 2018, 12:40pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/2 "2018-01-18T12:40:04Z")

</div>

Where do you store your `settings.json` file?

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 18, 2018, 12:55pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/3 "2018-01-18T12:55:58Z")

</div>

The file is supposed to be located in

```
myproject/src/main/resources/settings/
```

---

<div class="post-metadata">

**Author:** ![Hayk\_Hovhanisyan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayk_hovhanisyan/32/77342_2.png) [@Hayk\_Hovhanisyan](https://discuss.elastic.co/u/Hayk_Hovhanisyan)\
**Post date:** [January 18, 2018, 1:00pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/4 "2018-01-18T13:00:25Z")

</div>

The path is in`investigation-service/src/main/resources/settings/settings.json`.

The error I got because used that file under wrong service resource folder.  
My abstract class in `core-service`, but implementations in `investigation-service`.  
The solution is put it in `core-service` instead of.

Thank your for your question.

regards

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 18, 2018, 1:01pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/5 "2018-01-18T13:01:10Z")

</div>

Indeed, the problem was the location of the file. Glad you figured it out!

---

<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:** [February 15, 2018, 1:01pm UTC](https://discuss.elastic.co/t/creating-an-index-with-mappings-and-analysis-doesnt-work/116048/6 "2018-02-15T13:01:27Z")

</div>

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