Hello everyone
i am new to Elasticsearch, i need help with a use case,
I want to create an array inside an array using the aggregate option
The desired result is to have a list of services, for each service there will be a list of characteristics.
like that :
"services": [
{
"CreatedAt": "2021-09-28 11:49:51.7283241",
"idservice": 1,
"CreatedBy": "james.bond",
"NomService": "Traiter les cas API de test",
"typeServiceApplicatif": "back-end",
"Description": "<p>Service pour tester les cas API</p>",
**"characteristics " : ["characteristic1","characteristic2","characteristic3"]**
},
{
"CreatedAt": "2021-09-29 09:08:55.2606073",
"idservice": 2,
"CreatedBy": "bruce.lee",
"NomService": "TraiterCasWCF",
"typeServiceApplicatif": "back-end",
"Description": "<p>un service soap de test</p>",
**"characteristics" : ["characteristic1","characteristic2","characteristic3","characteristic4"]**
}
],
In the filter I currently have the following code :
map['services_list']||= []
map['services']||= []
if (event.get('idservice') != nil)
if !( map['services_list'].include? event.get('idservice') )
map['services_list'] << event.get('idservice')
map['services'] << {
'idservice' => event.get('idservice'),
'NomService' => event.get('nomservice'),
'CreatedAt' =>event.get('createdat'),
'CreatedBy' => event.get('createdby'),
'Description' => event.get('description'),
'typeServiceApplicatif' => event.get('typeserviceapplicatif'),
}
end
end
and I want to add a list of characteristics (characteristics " : ["char1","char2","char3",...] ... etc) for each service.
my SQL query is:
SELECT
equipe.Id,
equipe.Nom AS NomEquipe,
service_applicatif.NomService,
service_applicatif.Id AS IdService,
service_applicatif.CreatedAt,
service_applicatif.CreatedBy,
service_applicatif.Description,
type_service_applicatif.Indice As typeServiceApplicatif,
balise.Nom AS Characteristic,
Thank's