Tool to automatically generate documentation on elastic index

Viewed 231

I have a project on Kibana/Elastic. I can see / manipulate the indices and see the fields and value types with GET <index>/_mapping.

Other members (in particular, managers) in my team do not have access to Kibana and I need to write some documentation for them. Basically, I need to give them a view on what's in the indices.

I find myself copy pasting and simplifying (removing some not so informative layers) the json-like output of GET <index>/_mapping. That's not a good process.

Is there a tool that automates this, and ensures synchronisation between the db and the documentation?

1 Answers

I don't know of any tool that automates this. The simplest way, IMO, would be to create a single-page webapp which connects to ES and calls

GET _all/_mapping?format=yaml

which will return something like

myindex:
  mappings:
    properties:
      date1:
        type: "date"
      date2:
        type: "date"
      date3:
        type: "date"
      status:
        type: "text"
        fields:
          keyword:
            type: "keyword"
            ignore_above: 256

which is already more readable than JSON.


Going one step further, you could add a multi select dropdown to filter for specific fields, i.e.:

GET _all/_mapping/field/name,color?format=yaml

which would return something along the lines of

online_shop:
  mappings:
    color:
      full_name: "color"
      mapping:
        color:
          type: "keyword"
    name:
      full_name: "name"
      mapping:
        name:
          type: "text"
          fields:
            keyword:
              type: "keyword"
Related