# Querying array of obejcts

**URL:** <https://discuss.elastic.co/t/querying-array-of-obejcts/22890>\
**Category:** Elasticsearch\
**Created:** [March 25, 2015, 11:16am UTC](https://discuss.elastic.co/t/querying-array-of-obejcts/22890 "2015-03-25T11:16:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sheldon\_Hall](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@Sheldon\_Hall](https://discuss.elastic.co/u/Sheldon_Hall)\
**Post date:** [March 25, 2015, 11:16am UTC](https://discuss.elastic.co/t/querying-array-of-obejcts/22890/1 "2015-03-25T11:16:31Z")

</div>

Hi,

I have a field in my source that have the value:

[{"valid":true,"parser\_message":[{"message\_type":"INFO","description":"IP  
Address from this hit was anonymized to 166.78.33.0."}],"hit":"POST  
/debug/collect HTTP/1.1"}]

The following is my mapping, though I'm not sure it is correct

"field\_name": {  
properties: {  
valid: {type: "boolean"},  
hit: {  
type: "string",  
norms: {  
enabled: true  
},  
fields: {  
raw: {  
type: "string",  
index:"not\_analyzed"  
}  
}  
},  
parser\_messages: {  
properties: {  
message\_type: {type: "string"},  
description: {  
type: "string",  
norms: {  
enabled: false  
},  
fields: {  
raw: {  
type: "string",  
index:"not\_analyzed"  
}  
}  
},  
parameter: {type: "string"}  
}  
}  
}  
}

I'm trying to get a count of all unique descriptions. I won't really need  
to return the group parser\_messages objects so I'm not sure nested objects  
were needed.

What would a query look like for this?

I was trying

{  
"aggs" : {  
"field\_name" : {  
"terms" : {"field" : "field\_name"},

```
          "aggs" : {
              "description_count" : {
                "terms" : { "field" : "field_name.hit.raw" }
              }
          }
       }

  }

```

}

However doesn't return any results and I'm sure there is data for this  
field.

Any help would be much appreciated.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f8191ac6-8c60-4323-9b34-e81db6366a1f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f8191ac6-8c60-4323-9b34-e81db6366a1f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:24am UTC](https://discuss.elastic.co/t/querying-array-of-obejcts/22890/2 "2017-07-06T00:24:08Z")

</div>

Closed on July 6, 2017, 12:24am UTC


