How to return predefined response fields?

Hi,

Is there a way to configure kibana to return specified fields in the response from es?

I am building a custom visual and am currently receiving only the document term field that I queried and thats defined as key:

    "buckets": [
            {
              "key": "6000014",
              "doc_count": 24
            },
            {
              "key": "6000013",
              "doc_count": 23
            },
            {
              "key": "6000012",
              "doc_count": 3
            }
          ]

I would like something like this in my esResponse from within mu custom visual:

"buckets": [
                {
                  "id_1": "6000014",
                  "id_2": "1000014",
                  "doc_count": 24
                },
                {
                 "id_1": "6000013",
                  "id_2": "1000013"
                  "doc_count": 23
                },
                {
                  "id_1": "6000012",
                  "id_2": "1000012",
                  "doc_count": 23
                }
              ]

How would I go about doing this?

Regards benny

Hi Benny,

Kibana can't change the response from ES. May be you can use scripted fields in Kibana and build your visualization on top of it? Here is the documentation link for it: https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Here is where you will build them:

Let us know if that helps.

Thanks,
Bhavya

Hi Bhavya,

Thanks for your proposal.
I created a scripted field containing the two id's as you sugusted and was able to get that within my custom visual.

Regards benny

1 Like

Awesome. Thanks for keeping me posted.

Cheers
Bhavya

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.