# Separate fields from one document to create one document per field

**URL:** <https://discuss.elastic.co/t/separate-fields-from-one-document-to-create-one-document-per-field/179964>\
**Category:** Elasticsearch\
**Created:** [May 7, 2019, 12:06pm UTC](https://discuss.elastic.co/t/separate-fields-from-one-document-to-create-one-document-per-field/179964 "2019-05-07T12:06:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RemiFreret](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@RemiFreret](https://discuss.elastic.co/u/RemiFreret)\
**Post date:** [May 7, 2019, 12:06pm UTC](https://discuss.elastic.co/t/separate-fields-from-one-document-to-create-one-document-per-field/179964/1 "2019-05-07T12:06:38Z")

</div>

Hello,

Sorry if the title isn't really speaking but I don't know how to explain my problem in other way than giving a concrete example.  
So here is what I want to do :

I have an index where the document contains data like this :

`{ "value_A_1": 10, "value_A_2": 20, "value_A_3": 30, "value_B_1": 10, "value_B_2": 20, "value_B_3": 30, "value_C_1": 10, "value_C_2": 20, "value_C_3": 30 }`

But I want to have an index where a document is made of 3 value like this :

`{ "Letter": A, "Number": 1, "Value": 10 } { "Letter": A, "Number": 2, "Value": 20 } [...] { "Letter": C, "Number": 3, "Value": 30 }`

In this example, the input would be 1 document (one json) (with 9 différent fields) but the output on the index would be 9 different documents each containingsame fields (that describe the input field).

I don't know if I'm clear, I've made some research but didn't found what I want.  
I've lookup into reindexing, scripting ... but in vain  
I think I can manage to do that in a script but my goal is to do that directly into kibana either by reindexing or with a script, or both ...

Thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 4, 2019, 12:06pm UTC](https://discuss.elastic.co/t/separate-fields-from-one-document-to-create-one-document-per-field/179964/2 "2019-06-04T12:06:38Z")

</div>

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