I know, because I searched for it here on discuss, that using nested data/objects in Kibana seems to be a recurring topic but unfortunately I still have not found the answer I was looking for.
I am querying a Jenkins-API and get answers that look like the following code, that I would like to insert into Elasticsearch:
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
"actions": [
{},
{},
{},
{},
{
"_class": "hudson.plugins.jobConfigHistory.JobConfigHistoryProjectAction"
},
{},
{},
{},
{},
{},
{
"_class": "com.cloudbees.plugins.credentials.ViewCredentialsAction"
}
],
"description": "",
"displayName": "XYZ",
"displayNameOrNull": null,
"fullDisplayName": "XYZ",
"fullName": "XYZ",
"name": "XYZ",
"url": "https://url.com/job/XYZ/",
"buildable": true,
"builds": [
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 53,
"url": "https://url.com/job/XYZ/53/"
},
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 52,
"url": "https://https://url.com/job/XYZ/52/"
}, /*
{
!!! left out for better readability !!!
}, */
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 1,
"url": "https://url.com/job/XYZ/1/"
}
],
"color": "red",
"firstBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 1,
"url": "https://https://url.com/job/XYZ//1/"
},
"healthReport": [
{
"description": "Build stability: 1 out of the last 5 builds failed.",
"iconClassName": "icon-health-60to79",
"iconUrl": "health-60to79.png",
"score": 80
},
{
"description": "Test Result: 0 tests failing out of a total of 1,693 tests.",
"iconClassName": "icon-health-80plus",
"iconUrl": "health-80plus.png",
"score": 100
}
],
"inQueue": false,
"keepDependencies": false,
"lastBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 53,
"url": "https://https://url.com/job/XYZ/53/"
},
"lastCompletedBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 53,
"url": "https://https://url.com/job/XYZ/53/"
},
"lastFailedBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 53,
"url": "https://https://url.com/job/XYZ/53/"
},
"lastStableBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 51,
"url": "https:/https://url.com/job/XYZ/51/"
},
"lastSuccessfulBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 51,
"url": "https://https://url.com/job/XYZ/51/"
},
"lastUnstableBuild": null,
"lastUnsuccessfulBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"number": 53,
"url": "https://https://url.com/job/XYZ/53/"
},
"nextBuildNumber": 54,
"property": [
{
"_class": "hudson.plugins.buildblocker.BuildBlockerProperty"
},
{
"_class": "org.datadog.jenkins.plugins.datadog.DatadogJobProperty"
},
{
"_class": "hudson.model.ParametersDefinitionProperty",
"parameterDefinitions": [
{
"_class": "hudson.model.StringParameterDefinition",
"defaultParameterValue": {
"_class": "hudson.model.StringParameterValue",
"name": "SCM_REVISION",
"value": "default"
},
"description": "",
"name": "SCM_REVISION",
"type": "StringParameterDefinition"
}
]
},
{
"_class": "org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty"
},
{
"_class": "com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerJobProperty"
},
{
"_class": "com.sonyericsson.rebuild.RebuildSettings"
},
{
"_class": "com.synopsys.arc.jenkinsci.plugins.jobrestrictions.jobs.JobRestrictionProperty"
},
{
"_class": "org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty"
}
],
"queueItem": null,
"concurrentBuild": false,
"resumeBlocked": false
}
Now what is my best approach to be able to go over all my Jenkins jobs and visualize the healthReport scores for build stability in a histogram for example? I have the ES query to get the buckets but since it uses the nested query syntax the field isn't available in the "visualize" menu.
I have almost full control over the data, I can modify it freely before sending it to logstash and then ES.
What shall I do? Flatten and denormalize my data to that extent that I don't have nested objects?
How do I keep the semantic connection alive then? Include the information that links the two in both, so for example concerning the builds I would give every build the name of its pipeline and the pipeline just has an array of build names then (that you could also drop because it doesn't say anything but that's another story) and so on? Or is there any value in using parent-child relationships?
Thanks for the reply
Tobias