pteich / elastic-query-export

🚚 Export Data from ElasticSearch to CSV/JSON using a Lucene Query (e.g. from Kibana) or a raw JSON Query string
MIT License
89 stars 18 forks source link

Flatten document so nested objects are accessible #17

Closed asenci closed 1 year ago

asenci commented 2 years ago

This PR flattens the search result so the nested objects are accessible via "obj.nestedField" on the fields list.

The original object is retained in the original key for backwards compatibility (will result in a "map:[...]" value in the csv output).

See test cases for examples.

Fixes issue #16

andrii29 commented 1 year ago

Hello, @pteich can you merge this PR please? Ability to select some fields is a very useful option. It would be nice to keep it here, instead of building from fork.

Regards

pteich commented 1 year ago

Thanks for the ping @andrii29 I'll have a look and review it.

pteich commented 1 year ago

lgtm and is a useful feature. It could maybe nice to use the flatten function in a recursiv way to also address objects with deeper dimensions.

asenci commented 1 year ago

@pteich sorry, has been a while since I implemented this, but IIRC it should be processing the fields recursively (the very nested test case for example).