I want to generate some documentation for my Elasticsearch document structure. The problem is that i'm storing nested JSON in my index but i want to document the flattend JSON format¹ that Elasticsearch is generating.
Is there a way to flatten this JSON similar to the way that Elasticsearch is producing using the ES Java API?
If possible i don't want to startup Elasticsearch for this task.
Example JSON:
{
  "title": "Nest eggs",
  "body":  "Making your money work...",
  "tags":  [ "cash", "shares" ],
  "comments": [ 
    {
      "name":    "John Smith",
      "comment": "Great article",
      "age":     28,
      "stars":   4,
      "date":    "2014-09-01"
    },
    {
      "name":    "Alice White",
      "comment": "More like this please",
      "age":     31,
      "stars":   5,
      "date":    "2014-10-22"
    }
  ]
}
The document will look like this once Elasticsearch has flattend it.
{
  "title":            [ eggs, nest ],
  "body":             [ making, money, work, your ],
  "tags":             [ cash, shares ],
  "comments.name":    [ alice, john, smith, white ],
  "comments.comment": [ article, great, like, more, please, this ],
  "comments.age":     [ 28, 31 ],
  "comments.stars":   [ 4, 5 ],
  "comments.date":    [ 2014-09-01, 2014-10-22 ]
}
[1] https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html
