Mapping issue in adding a new filed to existing index

WE are using Spring-boot-Elasticsearch to create a index into elastic from java. We are facing a issue describe below:

Entity:
@Document(indexName = "user")
@Setting(settingPath = "/settings/lower-case-normalizer.json")
public class UserLoginEventsEntity {

@Id
@Field(type = FieldType.Keyword)
private String id;

@MultiField(mainField = @Field(type = FieldType.Text, fielddata=true), otherFields = {@InnerField(suffix = "raw", type = FieldType.Keyword, normalizer = "lower-case-normalizer") })
private String user;	

}
Below is the mapping looks like,
{
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"id": {
"type": "keyword"
},
"user": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"normalizer": "lower-case-normalizer"
}
},
"fielddata": true
}
}
}

lower-case-normalizer.json:
{
"index": {
"number_of_shards": 4,
"analysis": {
"normalizer": {
"lower-case-normalizer": {
"type": "custom",
"char_filter": ,
"filter": ["lowercase", "asciifolding"]
}
}
}
}
}
Added some data to the index using JAVA API calls, again tried to add the below filed in the same index,

@MultiField(mainField = @Field(type = FieldType.Text, fielddata=true), otherFields = {@InnerField(suffix = "raw", type = FieldType.Keyword, normalizer = "lower-case-normalizer") })
private String name;

And restartd the java application, Below is the mapping looks like:
{
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"id": {
"type": "keyword"
},
"user": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"normalizer": "lower-case-normalizer"
}
},
"fielddata": true
},
"sample3" : {
** "type" : "text",**
** "fields" : {**
** "keyword" : {**
** "type" : "keyword",**
** "ignore_above" : 256**
** }**
** }**
** }**
}
}

But excepted mapping is should be below:

{
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"id": {
"type": "keyword"
},
"user": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"normalizer": "lower-case-normalizer"
}
},
"fielddata": true
},
"sample3" : {
** "type" : "text",**
** "fields" : {**
** "raw" : {**
** "type" : "keyword",**
** "normalizer": "lower-case-normalizer"**
** }**
** },**
** "fielddata": true**
** }**
}
}

But the highlighted part is different.

We are currently using Elasticsearch version 7.17.5 and spring-data-elasticsearch version 4.4.2. , Spring boot 2.7.1 and java 1.8

Elastic running as a docker container.

Has anyone else encountered a similar issue? how to resolve this one?

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

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