I have schema which actually includes the nested type as shown below.
This is main schema.
@Document(indexName = "agreement")
public class PromotionSearchSchema {
@Field(type = FieldType.Nested, includeInParent = true)
private Promotion promotionproduct;
}
Now, the Promotion is the another entity inside main schema. So i have marked it as nested type. In the Promotion entity i'm trying to add analyzer as shown below
@Setting(settingPath = "es-config/elastic-analyzer.json")
public class Promotion {
@Field(type = FieldType.Text, analyzer = "autocomplete_index", searchAnalyzer = "autocomplete_search")
private String promotionDescription;
}
This is my elastic-analyzer.json
{
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete_search": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase"
]
},
"autocomplete_index": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
When i do like, it's not at all creating the complete mappings in the Elasticsearch. It's just creating as shown below
{
"agreement" : {
"mappings" : { }
}
}
So my question is how to add the analyzers in the nested type. Any help would be appreciated.
Add the @Setting
annotation to the top level entitty.