Good day evetyone. I have a question in making a query wich will count multiplication of value of two fields and then division of this multiplication on third field.
Example of data in index:
{
"_index" : "instruments",
"_type" : "_doc",
"_id" : "643265",
"_score" : null,
"_source" : {
"emShortName" : "Credit Agricole SA",
"emitent" : 545419,
"nominalCurr" : "GBP",
"expared" : false,
"ticker" : "CRAGgp",
"adfrontType" : "eurobonds",
"allowNonQualInvest" : false,
"emCode" : "CRAG",
"boardName" : "ECL counting in GBP",
"hellGroup" : "Bonds",
"universalExchangeId" : 3,
"cupPeriod" : 0,
"lot" : 1,
"universalMarketCode" : "EUCL_GBP",
"isEnabled" : true,
"actId" : 46781,
"cupSize" : 3.0,
"currency" : "GBP",
"matDate" : "2100-01-01",
"isin" : "FR0010575654",
"assetCode" : "FR0010575654",
"nkdCurr" : "GBP",
"faceUunit" : 378207,
"riskCurrency" : "GBP",
"isTradeAccess" : false,
"isLiquidBoard" : true,
"hellType" : "BondsCoupon",
"nkd" : 0.0,
"isDefaultUniversalExchange" : true,
"objectId" : 571980,
"displayGroup" : 2,
"name" : "Credit Agricole SA",
"nominal" : 50000.0,
"adfrontGroup" : "Bonds",
"bondTypeName" : "Corporate",
"idfi" : 643265,
"dailyPiPercent" : 0.0,
"price" : 88.54,
"yield" : 12.52,
"sessionDate" : "2024-05-06"
}
Example of counting fields: cup_yield (counted field) = cup_size*price/nominal.
I need to get this counted field in a search query with filter. For example, by "bondType".
It will be great if someone help to make this query. Thank you.