Creating an index with mappings and analysis doesn't work

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 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

Where do you store your settings.json file?

The file is supposed to be located in

myproject/src/main/resources/settings/
2 Likes

The path is ininvestigation-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

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

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