Along with the matched word elasticsearch is highlighting single letter present in the content field .
I am using elasticsearch1.7.2 . Below are mapping I am using .
I am highlighting content field .
PUT nms_repository
{
"settings": {
"analysis": {
"analyzer": {
"case_insensitive_sort": {
"tokenizer": "keyword",
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"document":{
"properties": {
"dataclass":{
"type": "nested",
"properties": {
"dataclassname":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"PickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
},
"NonPickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
}
}
},
"globalindex":{
"type": "nested",
"properties": {
"NonPickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
},
"PickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
}
}
},
"documentname":{"type": "string","index_analyzer":"case_insensitive_sort","copy_to":"suggestf"},
"**content**":{
"type": "string"
},
"owner":{"type": "string","index_analyzer":"case_insensitive_sort"},
"suggestf":{"type": "completion",
"analyzer": "simple",
"search_analyzer": "simple",
"payloads":true
}
}
},
"folder":{
"properties": {
"dataclass":{
"type": "nested",
"properties": {
"dataclassname":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"PickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
},
"NonPickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
}
}
},
"globalindex":{
"type": "nested",
"properties": {
"NonPickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
},
"PickableFields":{
"type": "nested",
"properties": {
"key":{"type": "string","index":"not_analyzed","copy_to":"suggestf"},
"value":{"type": "string","index":"not_analyzed","dynamic":true}
}
}
}
},
"documentname":{"type": "string","index_analyzer":"case_insensitive_sort","copy_to":"suggestf"},
"owner":{"type": "string","index_analyzer":"case_insensitive_sort"},
"suggestf":{"type": "completion",
"analyzer": "simple",
"search_analyzer": "simple",
"payloads":true
}
}
}
}
}