This is the sample object how my data is stored in an index.
{
_index: "crawled_websites",
_type: "crawled_websites",
_id: "1I4ZGGUBSEHPBwjchC_2",
_score: null,
_source: {
url: "https://ewn.co.za/Topic/Patricia-de-Lille",
description: "EWN - South African news: access breaking news alerts, sport, business, entertainment, opinion, multimedia and cartoons. Eyewitness News – INSIDE THE TRUTH",
updated_on: "2018-08-08 11:23:56",
keywords: "",
title: "Patricia de lille",
added_on: "2018-08-08 11:23:56",
backlinksArray: [
"https://ewn.co.za/Topic/Premier-Soccer-League",
"https://ewn.co.za/Topic/English-Premier-League",
"https://ewn.co.za/Topic/Absa-Premiership",
"https://ewn.co.za/Topic/Crusaders"
]
},
sort: [
1533727436000
]
}
Now what I want is to get the number of times the URL of current document exists in all other documents backlinksArray in function_score.
I'm using Painless language in function_score.
Thanks in advance!
As far as I understand, you want to get the backlinks count during the front end operation. However I believe that it would be good to store the count in advance and do operation accordingly.