Here is my ex document:
{ "categoryId" : 8,
"productId" : 12,
"starLevel" : 4.2,
"reviewList" : [
"foo",
"bar",
"foo bar",
"foo bar foo" ]
},
{ "categoryId" : 8,
"productId" : 11,
"starLevel" : 4.6,
"reviewList" : [
"foo",
"bar",
"bar bar",
"bar bar foo" ]
},
And search code:
client.search({
index: indexName,
size: 200,
body: {
query: {
match: {
"reviewList": "*foo*"
}
},
}
});
I can found right result with above query but i want to expand my query that include for all document like how many match on "reviewList" field.
Like this: For ProductId:12 "foo" matched 4 times, for ProductId: 11 "foo" matched 2 times.
How can i do?
In other words, I want to get highlighted field count as kibana doing.
Thanks.