# Can't work with object's properties for aggregations

**URL:** <https://discuss.elastic.co/t/cant-work-with-objects-properties-for-aggregations/285939>\
**Category:** Kibana\
**Created:** [October 5, 2021, 3:33pm UTC](https://discuss.elastic.co/t/cant-work-with-objects-properties-for-aggregations/285939 "2021-10-05T15:33:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_DRABO](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_drabo/32/95476_2.png) [@Thomas\_DRABO](https://discuss.elastic.co/u/Thomas_DRABO)\
**Post date:** [October 5, 2021, 3:33pm UTC](https://discuss.elastic.co/t/cant-work-with-objects-properties-for-aggregations/285939/1 "2021-10-05T15:33:21Z")

</div>

Hello everyone,  
I'm trying to work with a property containing an array of objects in my index. You can find the index's mapping behind.

This is my index mapping.

```auto
PUT test-index
{
  "mappings": {
    "properties": {
      "eventid": { "type": "text" },
      "eventdates": { "type": "date" },
      "machineid": {
        "type": "text",
        "fields": {
          "keyword": {
            "ignore_above": 256.0,
            "type": "keyword"
          }
        }
      },
      "products": {
        "properties": {
          "product": {
            "type": "text",
            "fields": {
              "keyword": {
                "ignore_above": 256.0,
                "type": "keyword"
              }
            }
          },
          "version": {
            "type": "text",
            "fields": {
              "keyword": {
                "ignore_above": 256.0,
                "type": "keyword"
              }
            }
          }
        }
      }
    }
  }
}

```

There is sample data of that index :

```auto
POST test-index/_doc 
{
  "eventid":"6025d4fa-35c4-477e-a063-924b867d8b0d",
  "eventdates":"2021-09-27T12:43:00.0331798+00:00",
  "machineid":"12",
  "products":{
    "Product1":"1.2.5.12",
    "Product2": "2.12.2.5",
    "Product3": "1.0.0.2"
  }
}

POST test-index/_doc 
{
  "eventid":"8825d4fa-35c4-477e-a063-924b867d8b0d",
  "eventdates":"2021-09-27T12:43:00.0331798+00:00",
  "machineid":"15",
  "products":{
    "Product2":"1.2.4.12",
    "Product3": "2.15.2.5",
    "Product4": "1.1.0.2"
  }
}

```

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

My goal is to create data table in Kibana like this picture.  
I triyed to configure the property with differents types (nested, flattened, object) but cannot made it work.  
If someone can help me for this, it will be very very helpful !  
Thank you ! 😄

---

<div class="post-metadata">

**Author:** ![ying.mao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ying.mao/32/88151_2.png) [@ying.mao](https://discuss.elastic.co/u/ying.mao)\
**Post date:** [October 7, 2021, 3:59pm UTC](https://discuss.elastic.co/t/cant-work-with-objects-properties-for-aggregations/285939/2 "2021-10-07T15:59:39Z")

</div>

Hi @Thomas_DRABO,

The way your index is currently mapped, it is looking for an exact match to the `product` field and since your field names are `Product1`, `Product2`, `ProductN`, it is likely not mapping those fields. Can you try [using dynamic templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#match-unmatch) in order to perform a prefix match on the field name?

Thanks,

---

<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:** [November 4, 2021, 4:00pm UTC](https://discuss.elastic.co/t/cant-work-with-objects-properties-for-aggregations/285939/3 "2021-11-04T16:00:13Z")

</div>

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