# Exact equal matches on nested object arrays?

**URL:** <https://discuss.elastic.co/t/exact-equal-matches-on-nested-object-arrays/53920>\
**Category:** Elasticsearch\
**Created:** [June 24, 2016, 7:56pm UTC](https://discuss.elastic.co/t/exact-equal-matches-on-nested-object-arrays/53920 "2016-06-24T19:56:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Drinkard](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@James\_Drinkard](https://discuss.elastic.co/u/James_Drinkard)\
**Post date:** [June 24, 2016, 7:56pm UTC](https://discuss.elastic.co/t/exact-equal-matches-on-nested-object-arrays/53920/1 "2016-06-24T19:56:04Z")

</div>

I'm working with ES 1.6 to find all the licenses of a particular type, however, I've found that term means contains, not equal to, so I pick up the license objects I want for that type, along with the ones I don't want. If the person has one license it works fine, the problem is when one person has multiple license types.

Here is a partial similar list of what I have for the mapping:  
"LICENSES": {  
"type": "nested",  
"include\_in\_parent": true,  
"doc\_values": true,  
"properties": {

```
      "LICENSE_TYPE": {
        "type": "string",
        "index": "not_analyzed",
        "doc_values": true
      },
      "START_DATE": {
        "type": "date",
        "format": "dateOptionalTime",
        "doc_values": true
      },
      "END_DATE": {
        "type": "date",
        "format": "dateOptionalTime",
        "doc_values": true
      },
      "LICENSE_NUMBER": {
        "type": "string",
        "index": "not_analyzed",
        "doc_values": true
      },
      ...
  },

```

What is the correct way to just return all the drivers LICENSES that have a LICENSE\_TYPE of Commercial Class B, and exclude Class A, Class, C, CDL, Motorcycle, etc... where a person can have multiple license types?

---

<div class="post-metadata">

**Author:** ![James\_Drinkard](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@James\_Drinkard](https://discuss.elastic.co/u/James_Drinkard)\
**Post date:** [June 25, 2016, 8:01pm UTC](https://discuss.elastic.co/t/exact-equal-matches-on-nested-object-arrays/53920/2 "2016-06-25T20:01:49Z")

</div>

After discussing with a co-worker, I found that this can be done using inner hits.

---

<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 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/exact-equal-matches-on-nested-object-arrays/53920/3 "2017-07-05T22:40:31Z")

</div>

Closed on July 5, 2017, 10:40pm UTC


