# path\_hierarchy in my settings / mapping Not Working

**URL:** <https://discuss.elastic.co/t/path-hierarchy-in-my-settings-mapping-not-working/23546>\
**Category:** Elasticsearch\
**Created:** [May 4, 2015, 7:37pm UTC](https://discuss.elastic.co/t/path-hierarchy-in-my-settings-mapping-not-working/23546 "2015-05-04T19:37:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Iverson](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@Jack\_Iverson](https://discuss.elastic.co/u/Jack_Iverson)\
**Post date:** [May 4, 2015, 7:37pm UTC](https://discuss.elastic.co/t/path-hierarchy-in-my-settings-mapping-not-working/23546/1 "2015-05-04T19:37:04Z")

</div>

Hello,

I'm trying to add taxonomies into my index. I add them like the following  
below.

However, when I do an aggregation as shown below the output breaks up "best  
price" into two separate buckets.  
I want "best price" to be only one bucket. What I mean is I don't want my  
taxonomies being broken up by whitespace or any other special characters  
like &, only by /

When I do curl -XGET  
'localhost:9200/\_analyze?tokenizer=path\_hierarchy&pretty' -d  
'/cars/economy/best price' then it behaves the way I want it to where  
"best price" is not broken up on whitespace. I'm not sure what is wrong.

Below is my code:

curl -XPUT 'localhost:9200/myindex' -d ' {  
"settings":{  
"index": {  
"analysis":{  
"analyzer":{  
"analyzer\_taxonomy": {  
"type": "custom",  
"tokenizer": "path\_hierarchy"  
}  
}  
}  
}  
},  
"mappings":{  
"myindex":{  
"properties":{  
"catalog":{  
"properties":{  
"price":{  
"type":"float"  
},  
"name":{  
"type":"string",  
"index":"not\_analyzed"  
},  
"description":{  
"type":"string"  
},  
"taxonomies":{  
"analyzer":"analyzer\_taxonomy",  
"type":"string"  
}  
}  
}  
}  
}  
}  
}'

curl -XPUT 'localhost:9200/myindex/catalog/1' -d ' {  
"name":"corolla",  
"price":17999,  
"description":"this is a car that is a car that gets you places",  
"taxonomies":"/cars/economy"  
}'

curl -XPUT 'localhost:9200/myindex/catalog/2' -d ' {  
"name":"ferrari",  
"price":221500,  
"description":"this is a car that is a quick car",  
"taxonomies":"/cars/ultimate"  
}'

curl -XPUT 'localhost:9200/myindex/catalog/3' -d ' {  
"name":"ferrari500",  
"price":521500,  
"description":"this is a car that is fast car!!!",  
"taxonomies":"/cars/ultimate/extreme"  
}'

curl -XPUT 'localhost:9200/myindex/catalog/4' -d ' {  
"name":"tercel",  
"price":2500,  
"description":"this is a car that is affordable",  
"taxonomies":"/cars/economy/best price"  
}'

curl -XPOST 'localhost:9200/myindex/\_search?pretty' -d ' {  
"size":0,  
"aggs":{  
"stuff":{  
"terms":{  
"field":"taxonomies"  
}  
}  
}  
}'

* * *

```
OUTPUT

```

* * *

{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 4,  
"max\_score" : 0.0,  
"hits" : []  
},  
"aggregations" : {  
"stuff" : {  
"doc\_count\_error\_upper\_bound" : 0,  
"sum\_other\_doc\_count" : 0,  
"buckets" : [ {  
"key" : "cars",  
"doc\_count" : 4  
}, {  
"key" : "economy",  
"doc\_count" : 2  
}, {  
"key" : "ultimate",  
"doc\_count" : 2  
}, {  
"key" : "best",  
"doc\_count" : 1  
}, {  
"key" : "extreme",  
"doc\_count" : 1  
}, {  
"key" : "price",  
"doc\_count" : 1  
} ]  
}  
}  
}

--  
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/cdd971a8-2225-4335-a63c-309bf45f778b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cdd971a8-2225-4335-a63c-309bf45f778b%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:15am UTC](https://discuss.elastic.co/t/path-hierarchy-in-my-settings-mapping-not-working/23546/2 "2017-07-06T00:15:49Z")

</div>


