With Spring-Data-Elasticsearch, I am trying to use analyzers and mappings defined in elasticsearch_config.json.
This JSON file is in /src/main/resources
Finally found out why it was not working!!
Like Val said, I decomposed my elasticsearch_config.json file into settings.json and mappings.json.
My project/src/main/ressources architecture:
- mappings
+ mappings.json
- settings
+ settings.json
And
@Document(indexName = "test", type="SentimentTweet")
@Setting(settingPath = "/settings/settings.json")
@Mapping(mappingPath = "/mappings/mappings.json")
However, in mappings.json, I should omit the field mappings and DIRECTLY put the content of the mapping.
INSTEAD OF:
{
"mappings": {
"Tweet": {
/* MAPPINGS CONFIGURATION ARE OMITTED */
}
}
}
Only writes in mappings.json:
{
"Tweet": {
/* MAPPINGS CONFIGURATION ARE OMITTED */
}
}
The same should be done for settings.json