Group Documents by it's similarity

Hello,

I want to group the similar documents.

Here is sample documents

document 1 : {
 _id : 1,
message : "Have an adventurous and romantic valentines day this year"
}

document 2 : {
 _id : 2,
message : "Great ride with the car"
}

document 3 : {
 _id : 3,
message : "Had very romantic valentines day this year"
}

document 4 : {
 _id : 4,
message : "Night ride with my car was awesome"
}

from the above sample documents. I expect the output something like below one.

"aggregations": {
   "buckets": [
   {
       "key" : "Have an adventurous and romantic valentines day this year",
        doc_count": 2,
        "hits": [
             {
                 "id":1,
                 "message" :  "Have an adventurous and romantic valentines day this year"
             } ,   
            {
                 "id":3,
                 "message" :  "Had very romantic valentines day this year"
             } 
         ]
},
{
       "key" : "Great ride with the car",
        doc_count": 2,
        "hits": [
             {
                 "id":2,
                 "message" :  "Great ride with the car"
             } ,   
            {
                 "id":4,
                 "message" :  "Night ride with my car was awesome"
             } 
         ]
}
]
}

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