Fetch records with Group by with Completion Suggester

{
"XYZ": {
"mappings": {
"properties": {
"customerInfo": {
"properties": {
"emailList": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"id": {
"type": "text",
"fields": {
"completion": {
"type": "completion",
"analyzer": "standard",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50,
"contexts": [
{
"name": "mailboxIdStr",
"type": "CATEGORY",
"path": "mailboxIdStr"
}
]
},
"keyword": {
"type": "keyword"
}
}
},
"name": {
"type": "text",
"fields": {
"completion": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50,
"contexts": [
{
"name": "mailboxIdStr",
"type": "CATEGORY",
"path": "mailboxIdStr"
}
]
},
"keyword": {
"type": "keyword"
}
},
"fielddata": true
}
}
}
}
}
}
}

I need customer name group by customerid as per below.

Name              customerid
John              1	
John 		      2
John12 	          3

Instead of only pasting snippets, how about you start a little bit earlier by giving a bit of context, coming up with a problem statement, how far you got, what you expected to work and how the actual result differs.

Writing a good problem description is hard work, but will help to get your issue solved or just looked at. See also https://www.elastic.co/help

Thanks!

I have put my code on PASTEBIN with description what i'm doing and what response i get.

Link: https://pastebin.com/6gcaXZGz

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