# Alternative to Array type in Kibana

**URL:** https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796
**Category:** Kibana
**Created:** [August 21, 2017, 4:04pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796 "2017-08-21T16:04:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Huffs](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@Huffs](https://discuss.elastic.co/u/Huffs)
#### Post date: [August 21, 2017, 4:04pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796/1 "2017-08-21T16:04:32Z")

</div>

Hello everybody,

Before everything, I´m sorry for my bad english. I´ll try to be clear and brief.

I have a huge problem. I don´t know how can I do my mapping and show in Kibana the following things.

Everyone has name,age,and state that their was born. But each person can have more then one likes.  
For example: foods, relax, beach, soccer, etc.

I know that Kibana doesn´t support Array, Nested or Object types. So I´m trying to do it the way I´m showing it down.

This is my mapping

PUT elastic  
{  
"mappings": {  
"person": {  
"\_all": { "enabled": false },  
"properties": {  
"name": {"type": "keyword"},  
"age" : {"type" : "keyword"},  
"state": {"type": "keyword"},  
"likes": {"type": "keyword"}  
}  
}  
}  
}

PUT elastic/person/1  
{  
"name": "Mikhael",  
"age": "24",  
"state": "SP",  
"likes": "foods"  
}

PUT elastic/person/2  
{  
"name": "Mikhael",  
"age": "24",  
"state": "SP",  
"likes": "relax"  
}

PUT elastic/person/3  
{  
"name": "James",  
"age": "21",  
"state": "SP",  
"likes": "beach"  
}

PUT elastic/person/4  
{  
"name": "Oliver",  
"age": "24",  
"state": "RJ",  
"likes": "foods"  
}

When I try to term in Kibana by age, likes and name. The count is incorrect. How you can see below.

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d8ecdeee47cc2bbce089bb84d03be59c3d00606.png)

The real value of count is three, not four.

Someone has a light at the end of the tunnel for me.

Thank you

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [August 21, 2017, 7:45pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796/2 "2017-08-21T19:45:35Z")

</div>

Hi Mikhael, I think you want to store all of your like values on a single field of a single person's document. I took a look at the [Array datatype docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html) and it looks like you want something like this:

```auto
PUT elastic/person/1
{
  “name”: “Mikhael”,
  “age”: “24”,
  “state”: “SP”,
  “likes”: [“foods”, “relax”]
}

```

Does this help?

Thanks,  
CJ

---

<div class="post-metadata">

### Author: ![Huffs](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@Huffs](https://discuss.elastic.co/u/Huffs)
#### Post date: [August 22, 2017, 1:00pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796/3 "2017-08-22T13:00:45Z")

</div>

Hello CJ,

Yes, it helps in part.

Because sometimes I don´t know how many "likes" each person can have.  
Today I know that I like foods and relax, but tomorrow maybe I'll like sports too.

EX:

I had the below document yesterday.

PUT elastic/person/1  
{  
“name”: “Mikhael”,  
“age”: “24”,  
“state”: “SP”,  
“likes”: [“foods”, “relax”]  
}

But,today I like sports too.

EX:

PUT elastic/person/1  
{  
“name”: “Mikhael”,  
“age”: “24”,  
“state”: “SP”,  
“likes”: [“foods”, “relax”, “sports”]  
}

How can I deal with this? Need I update my document?

Should I search for the existing name "Mikhael" than update the same document with the olds (foods,relax) and the new (sports) value of "likes"?

Thanks for your helping

---

<div class="post-metadata">

### Author: ![Huffs](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@Huffs](https://discuss.elastic.co/u/Huffs)
#### Post date: [August 22, 2017, 2:43pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796/4 "2017-08-22T14:43:17Z")

</div>

Hello CJ,

I have another question. I was thinking about how my Kibana could show my below data.

PUT action  
{  
"mappings": {  
"user": {  
"\_all": { "enabled": false },  
"properties": {  
"name": {"type": "keyword"},  
"age" : {"type" : "keyword"},  
"date": {"type": "date", "format": "dd/MM/yyyy HH:mm:ss"},  
"action": {"type": "keyword"}  
}  
}  
}  
}

So, I add this document

PUT action/user/1  
{  
"name": "Mikhael",  
"age": "24",  
"date":["22/08/2017 09:00:00","22/08/2017 10:00:00"],  
"action": ["opening","closing"]  
}

But, take a look to my Kibana.

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dcba9a5fed8e9abfa5a65666e82b5400433e53f1.png)

I can't understand. Why is it happen? How could I change it?

I was expecting:

date : 22/08/2017 09:00:00, action: opening  
date : 22/08/2017 10:00:00, action : closing

Thank you for your attention

---

<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: [September 19, 2017, 2:43pm UTC](https://discuss.elastic.co/t/alternative-to-array-type-in-kibana/97796/5 "2017-09-19T14:43:36Z")

</div>

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