Reputation: 9983
I can't seem to get nested objects to highlight when using an _all search.
My index:
{
"settings":{
"analysis":{
"analyzer":{
"nGramAnalyzer":{
"type":"custom",
"filter":[
"lowercase",
"asciifolding",
"NGramFilter"
],
"tokenizer":"WhitespaceTokenizer"
},
"WhitespaceAnalyzer":{
"type":"custom",
"filter":[
"lowercase",
"asciifolding"
],
"tokenizer":"WhitespaceTokenizer"
},
},
"filter":{
"NGramFilter":{
"type":"ngram",
"min_gram":1,
"max_gram":20
}
},
"tokenizer":{
"WhitespaceTokenizer":{
"type":"whitespace"
}
}
}
},
"mappings":{
"CustomerSearchResult":{
"_all":{
"analyzer":"nGramAnalyzer",
"search_analyzer":"WhitespaceAnalyzer"
},
"properties":{
"customerId":{
"type":"string",
"index":"not_analyzed"
},
"remarks":{
"type":"nested",
"properties":{
"remarkId":{
"type":"integer"
},
"customerId":{
"type":"integer"
},
"remarkText":{
"type":"string",
"index":"analyzed",
"analyzer":"nGramAnalyzer",
"search_analyzer":"WhitespaceAnalyzer"
}
}
},
}
}
}
}
My Query:
{
"from":0,
"size":100,
"highlight":{
"pre_tags":[
"<b>"
],
"post_tags":[
"<b>"
],
"fields":{
"remarks.remarkText":{
}
}
},
"_source":{
"exclude":[
"remarks"
]
},
"query":{
"match":{
"_all":{
"query":"test",
"operator":"and"
}
}
}
}
If I query using a nested query, I do get highlights, but I need to search _all. I've tried setting include in parent, include in root, but it didn't make a difference.
I'm excluding remarks because I don't want to actually return them, just their highlights. I've tried the query without the exclude as well.
I only need highlights for the nested object.
Upvotes: 0
Views: 555