Hi everyone ! can anyone please help me convert below query in java i'm struggling with the aggregation part i have been stuck to this for days now , any help would be appreciated
{
"query": {},
"aggregations": {
"authentication_attempts_by_day_and_structure_id": {
"filters": {
"filters": {
"authentication_attempts": {
"terms": {
"custom_request": ["path1", "path2", "path3"],
"boost": 1.0
}
},
"failed_authentication_attempts": {
"bool": {
"filter": [{
"terms": {
"custom_request": ["path4", "path5", "path6"],
"boost": 1.0
}
}, {
"terms": {
"httpcode": ["404", "500"],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
},
"other_bucket": false,
"other_bucket_key": "_other_"
},
"aggregations": {
"byStructureId": {
"terms": {
"field": "structureid",
"size": 200,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": {
"_key": "asc"
}
},
"aggregations": {
"byDay": {
"terms": {
"script": {
"source": "doc['@timestamp'].value.withZoneSameInstant(ZoneId.of('Europe/Paris')).toLocalDate()",
"lang": "painless"
},
"size": 31,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": {
"_key": "asc"
}
}
}
}
}
}
}
}
}