# Nested document & require ignore case

**URL:** <https://discuss.elastic.co/t/nested-document-require-ignore-case/8174>\
**Category:** Elasticsearch\
**Created:** [June 20, 2012, 5:25pm UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174 "2012-06-20T17:25:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garth](https://avatars.discourse-cdn.com/v4/letter/g/ba9def/32.png) [@Garth](https://discuss.elastic.co/u/Garth)\
**Post date:** [June 20, 2012, 5:25pm UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174/1 "2012-06-20T17:25:44Z")

</div>

Example:

blah [{  
type : group,  
name : wombat  
accounts : [a b c]  
},  
{  
type : group,  
name : ferret  
accounts : [x y z]  
}]

Originally our queries were returning the incorrect answers if we did: name  
: ferret & accounts : [a b] we would get data back. We realized that we  
had to create a mapping for nested document and set the fields as  
"not\_analyzed". That works great except when character case is not  
conformant. Name could be "Ferret" or "feRret" etc. How do I map this puppy  
to be not\_analyzed and ignore case? Plenty of discussions about it then  
being analyzed. But nested does not allow for that.

Thanks  
Garth

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 21, 2012, 7:22am UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174/2 "2012-06-21T07:22:51Z")

</div>

You can configure a custom analyzer, with keyword tokenizer and lowercase  
filter. keyword tokenizer will make sure all the text is a single token,  
and lowercase will lowercase the characters.

On Wed, Jun 20, 2012 at 7:25 PM, Garth [ghershfield.bah@gmail.com](mailto:ghershfield.bah@gmail.com) wrote:

> Example:
> 
> blah [{  
> type : group,  
> name : wombat  
> accounts : [a b c]  
> },  
> {  
> type : group,  
> name : ferret  
> accounts : [x y z]  
> }]
> 
> Originally our queries were returning the incorrect answers if we did:  
> name : ferret & accounts : [a b] we would get data back. We realized that  
> we had to create a mapping for nested document and set the fields as  
> "not\_analyzed". That works great except when character case is not  
> conformant. Name could be "Ferret" or "feRret" etc. How do I map this puppy  
> to be not\_analyzed and ignore case? Plenty of discussions about it then  
> being analyzed. But nested does not allow for that.
> 
> Thanks  
> Garth

---

<div class="post-metadata">

**Author:** ![Garth](https://avatars.discourse-cdn.com/v4/letter/g/ba9def/32.png) [@Garth](https://discuss.elastic.co/u/Garth)\
**Post date:** [June 21, 2012, 11:54am UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174/3 "2012-06-21T11:54:09Z")

</div>

Tried that and the funky results started showing up again. Where "ferret" &  
"a" would return a doc. Obviously doing something wrong.

On Thursday, June 21, 2012 3:22:51 AM UTC-4, kimchy wrote:

> You can configure a custom analyzer, with keyword tokenizer and lowercase  
> filter. keyword tokenizer will make sure all the text is a single token,  
> and lowercase will lowercase the characters.
> 
> Example:
> 
> > blah [{  
> > type : group,  
> > name : wombat  
> > accounts : [a b c]  
> > },  
> > {  
> > type : group,  
> > name : ferret  
> > accounts : [x y z]  
> > }]
> > 
> > Originally our queries were returning the incorrect answers if we did:  
> > name : ferret & accounts : [a b] we would get data back. We realized that  
> > we had to create a mapping for nested document and set the fields as  
> > "not\_analyzed". That works great except when character case is not  
> > conformant. Name could be "Ferret" or "feRret" etc. How do I map this puppy  
> > to be not\_analyzed and ignore case? Plenty of discussions about it then  
> > being analyzed. But nested does not allow for that.
> > 
> > Thanks  
> > Garth

---

<div class="post-metadata">

**Author:** ![Garth](https://avatars.discourse-cdn.com/v4/letter/g/ba9def/32.png) [@Garth](https://discuss.elastic.co/u/Garth)\
**Post date:** [June 21, 2012, 5:10pm UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174/4 "2012-06-21T17:10:32Z")

</div>

Got it.

---

<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, 3:23am UTC](https://discuss.elastic.co/t/nested-document-require-ignore-case/8174/5 "2017-07-06T03:23:04Z")

</div>


