# Elasticsearch - Object or Array Datatype

**URL:** <https://discuss.elastic.co/t/elasticsearch-object-or-array-datatype/100294>\
**Category:** Elasticsearch\
**Created:** [September 13, 2017, 6:31am UTC](https://discuss.elastic.co/t/elasticsearch-object-or-array-datatype/100294 "2017-09-13T06:31:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [September 13, 2017, 6:31am UTC](https://discuss.elastic.co/t/elasticsearch-object-or-array-datatype/100294/1 "2017-09-13T06:31:55Z")

</div>

Hi,

I am parsing proxy logs. These contain around 3 IP address fields. I wish to create a structure, in which IP is the main field with multiple sub-fields present.

The final structure would be similar to something like this:

```
logs/proxy/1
    { 
      "device": "bluecoat",
      "category": "basic internet"
       "IP": { 
          "device": "10.0.0.1",
          "source": "10.4.4.1"
          "destination": "104.49.44.1"
        }     
    }

```

What I want to understand is, which is the most effective way of achieving this in elasticsearch? The data is going to exponentially increase and if I have to query IP to find if x.x.x.x is present, which would be the most effective way of achieving this?

> [Arrays | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html)  
> [Object field type | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/object.html)

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [September 13, 2017, 8:14am UTC](https://discuss.elastic.co/t/elasticsearch-object-or-array-datatype/100294/2 "2017-09-13T08:14:50Z")

</div>

This is so obvious! I almost missed the fact that what I wish to achieve is the Nested DataType.

> [Accessing event data and fields | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html)  
> [Nested field type | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html)

---

<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:** [October 11, 2017, 8:15am UTC](https://discuss.elastic.co/t/elasticsearch-object-or-array-datatype/100294/3 "2017-10-11T08:15:51Z")

</div>

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