How to program the Kibana field (Elasticsearch) with software?

The Kibana user interface allows the user to create a script field that is stored as part of the index (screenshot below). How can this be done programmatically? In particular, using either the NEST client or the low-level Elasticsearch client.

Kibana tab for display with the Script tab highlighted

Please note that I am not asking how to create the addition of an expression / script field as part of the query, I am specifically looking for how to add it as part of the Index when creating the mapping, so that queries can reference it without specifying it explicitly.

+4
source share
2

Kibana .kibana. , Kibana, . , curl -XGET http://localhost:9200/.kibana/_search?type=dashboard&pretty JSON . , JSON, POST. Kibana Elasticsearch, Elasticsearch API Kibana. .

+1

5.2 .

:

  • : GET/.kibana/index-pattern/YOUR_INDEX
  • _source.fields ( , )

    "fields":"[...,{\"name\":\"test\",\"type\":\"number\",\"count\":0,\"scripted\":true,\"script\":\"doc['area_id'].value\",\"lang\":\"painless\",\"indexed\":false,\"analyzed\":false,\"doc_values\":false,\"searchable\":true,\"aggregatable\":true}]"
    
  • _source json /.kibana/index-pattern/YOUR_INDEX

    {
        "title":"YOUR_INDEX",
        "timeFieldName":"time",
        "fields":"[...,{\"name\":\"test\",...}]"
    }
    
+1

Source: https://habr.com/ru/post/1655748/


All Articles