# Can't get path\_hierarchy tokenizer working

**URL:** <https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201>\
**Category:** Elasticsearch\
**Created:** [May 31, 2013, 6:43am UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201 "2013-05-31T06:43:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)\
**Post date:** [May 31, 2013, 6:43am UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201/1 "2013-05-31T06:43:33Z")

</div>

Hi all,

I have a default-mapping.json like so:

{  
"_default_" : {  
"dynamic\_templates" : [  
{  
"template\_1" : {  
"match" : "folder",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string",  
"index" : {  
"analysis" : {  
"analyzer\_keyword" : {  
"tokenizer" : "path\_hierarchy"  
}  
}  
}  
}  
}  
},  
{  
"template\_2" : {  
"match" : "\*",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string",  
"index" : "not\_analyzed"  
}  
}  
}  
]  
}  
}

When I try indexing a doc, I get this:

failed to execute bulk item (index) index {[fury][product][guid1],  
source[{"guid": "guid1", "timestamp": 1369982103, "folder":  
"/tox/seq1/shot1/chicken/3", "version": 3}]}  
org.elasticsearch.index.mapper.MapperParsingException: Wrong value for  
index [{analysis={analyzer\_keyword={tokenizer=path\_hierarchy}}}] for field  
[folder]

I don't understand what the problem is - the folder field is a string, what  
then does "wrong value for index" refer to? The documentation doesn't make  
configuration of mappings very clear.

Thanks,  
Allan

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)\
**Post date:** [May 31, 2013, 7:18am UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201/2 "2013-05-31T07:18:33Z")

</div>

Ok I think the structure of my json here is a bit wrong. But, I can't work  
out where I'm supposed to define my analyzer so that I can refer to it in  
default-mappings.json. I just need to refer to a path\_hierarchy analyzer.  
How do I do this?

thanks  
A

On Fri, May 31, 2013 at 4:43 PM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:

> Hi all,
> 
> I have a default-mapping.json like so:
> 
> {  
> "_default_" : {  
> "dynamic\_templates" : [  
> {  
> "template\_1" : {  
> "match" : "folder",  
> "match\_mapping\_type" : "string",  
> "mapping" : {  
> "type" : "string",  
> "index" : {  
> "analysis" : {  
> "analyzer\_keyword" : {  
> "tokenizer" : "path\_hierarchy"  
> }  
> }  
> }  
> }  
> }  
> },  
> {  
> "template\_2" : {  
> "match" : "\*",  
> "match\_mapping\_type" : "string",  
> "mapping" : {  
> "type" : "string",  
> "index" : "not\_analyzed"  
> }  
> }  
> }  
> ]  
> }  
> }
> 
> When I try indexing a doc, I get this:
> 
> failed to execute bulk item (index) index {[fury][product][guid1],  
> source[{"guid": "guid1", "timestamp": 1369982103, "folder":  
> "/tox/seq1/shot1/chicken/3", "version": 3}]}  
> org.elasticsearch.index.mapper.MapperParsingException: Wrong value for  
> index [{analysis={analyzer\_keyword={tokenizer=path\_hierarchy}}}] for field  
> [folder]
> 
> I don't understand what the problem is - the folder field is a string,  
> what then does "wrong value for index" refer to? The documentation doesn't  
> make configuration of mappings very clear.
> 
> Thanks,  
> Allan

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 31, 2013, 6:48pm UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201/3 "2013-05-31T18:48:58Z")

</div>

Define your analyzer separately and then use

On Fri, May 31, 2013 at 12:18 AM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:

> Ok I think the structure of my json here is a bit wrong. But, I can't work  
> out where I'm supposed to define my analyzer so that I can refer to it in  
> default-mappings.json. I just need to refer to a path\_hierarchy analyzer.  
> How do I do this?
> 
> thanks  
> A
> 
> On Fri, May 31, 2013 at 4:43 PM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:
> 
> > Hi all,
> > 
> > I have a default-mapping.json like so:
> > 
> > {  
> > "_default_" : {  
> > "dynamic\_templates" : [  
> > {  
> > "template\_1" : {  
> > "match" : "folder",  
> > "match\_mapping\_type" : "string",  
> > "mapping" : {  
> > "type" : "string",  
> > "index" : {  
> > "analysis" : {  
> > "analyzer\_keyword" : {  
> > "tokenizer" : "path\_hierarchy"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > },  
> > {  
> > "template\_2" : {  
> > "match" : "\*",  
> > "match\_mapping\_type" : "string",  
> > "mapping" : {  
> > "type" : "string",  
> > "index" : "not\_analyzed"  
> > }  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > When I try indexing a doc, I get this:
> > 
> > failed to execute bulk item (index) index {[fury][product][guid1],  
> > source[{"guid": "guid1", "timestamp": 1369982103, "folder":  
> > "/tox/seq1/shot1/chicken/3", "version": 3}]}  
> > org.elasticsearch.index.mapper.MapperParsingException: Wrong value for  
> > index [{analysis={analyzer\_keyword={tokenizer=path\_hierarchy}}}] for field  
> > [folder]
> > 
> > I don't understand what the problem is - the folder field is a string,  
> > what then does "wrong value for index" refer to? The documentation doesn't  
> > make configuration of mappings very clear.
> > 
> > Thanks,  
> > Allan
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 31, 2013, 6:51pm UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201/4 "2013-05-31T18:51:04Z")

</div>

Sorry, submitting by mistake.

Define your analyzer separately and then use the analyzer like with any  
other field.

"mapping" : {  
"type" : "string",  
"analyzer" : "analyzer\_keyword"  
}

On Fri, May 31, 2013 at 11:48 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Define your analyzer separately and then use
> 
> On Fri, May 31, 2013 at 12:18 AM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:
> 
> > Ok I think the structure of my json here is a bit wrong. But, I can't  
> > work out where I'm supposed to define my analyzer so that I can refer to it  
> > in default-mappings.json. I just need to refer to a path\_hierarchy  
> > analyzer. How do I do this?
> > 
> > thanks  
> > A
> > 
> > On Fri, May 31, 2013 at 4:43 PM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:
> > 
> > > Hi all,
> > > 
> > > I have a default-mapping.json like so:
> > > 
> > > {  
> > > "_default_" : {  
> > > "dynamic\_templates" : [  
> > > {  
> > > "template\_1" : {  
> > > "match" : "folder",  
> > > "match\_mapping\_type" : "string",  
> > > "mapping" : {  
> > > "type" : "string",  
> > > "index" : {  
> > > "analysis" : {  
> > > "analyzer\_keyword" : {  
> > > "tokenizer" : "path\_hierarchy"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > },  
> > > {  
> > > "template\_2" : {  
> > > "match" : "\*",  
> > > "match\_mapping\_type" : "string",  
> > > "mapping" : {  
> > > "type" : "string",  
> > > "index" : "not\_analyzed"  
> > > }  
> > > }  
> > > }  
> > > ]  
> > > }  
> > > }
> > > 
> > > When I try indexing a doc, I get this:
> > > 
> > > failed to execute bulk item (index) index {[fury][product][guid1],  
> > > source[{"guid": "guid1", "timestamp": 1369982103, "folder":  
> > > "/tox/seq1/shot1/chicken/3", "version": 3}]}  
> > > org.elasticsearch.index.mapper.MapperParsingException: Wrong value for  
> > > index [{analysis={analyzer\_keyword={tokenizer=path\_hierarchy}}}] for field  
> > > [folder]
> > > 
> > > I don't understand what the problem is - the folder field is a string,  
> > > what then does "wrong value for index" refer to? The documentation doesn't  
> > > make configuration of mappings very clear.
> > > 
> > > Thanks,  
> > > Allan
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:33am UTC](https://discuss.elastic.co/t/cant-get-path-hierarchy-tokenizer-working/12201/5 "2017-07-06T02:33:32Z")

</div>


