# How can I import data that belongs to array?

**URL:** <https://discuss.elastic.co/t/how-can-i-import-data-that-belongs-to-array/276818>\
**Category:** Kibana\
**Created:** [June 23, 2021, 3:45pm UTC](https://discuss.elastic.co/t/how-can-i-import-data-that-belongs-to-array/276818 "2021-06-23T15:45:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![111485](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111485/32/90705_2.png) [@111485](https://discuss.elastic.co/u/111485)\
**Post date:** [June 23, 2021, 3:45pm UTC](https://discuss.elastic.co/t/how-can-i-import-data-that-belongs-to-array/276818/1 "2021-06-23T15:45:53Z")

</div>

![q1](https://us1.discourse-cdn.com/elastic/original/3X/9/5/95691d7371893654676796fb271d53f02c07188f.png)

I want to separate STRING into ARRAY and get a count.

The example is as follows. (Table)

Name Count  
MG3 | 2  
MG4 | 1

When set through KIBANA LENS, it is only enabled as a keyword, and when set, only the count of record option is enabled.

When set to count of record, of course, this data changes as below.

MG3 | 1  
MG4 | 1

Is there a good way?

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [June 23, 2021, 3:50pm UTC](https://discuss.elastic.co/t/how-can-i-import-data-that-belongs-to-array/276818/2 "2021-06-23T15:50:47Z")

</div>

Hi, as you might be aware [all mapping types in Elasticsearch are arrays](https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html) due to the way Elasticsearch works. There is an aggregation that's able to calculate the count of the array field, which is called Value Count, but it's [not supported by Lens](https://www.elastic.co/guide/en/kibana/current/aggregation-reference.html#metrics-aggregations).

As a workaround, you can create a scripted field that returns the size of the `grade` values array, and then take the sum in Lens.

---

<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:** [July 21, 2021, 3:50pm UTC](https://discuss.elastic.co/t/how-can-i-import-data-that-belongs-to-array/276818/3 "2021-07-21T15:50:57Z")

</div>

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