Hi all,
I'm attempting to search for all items at the current path level of my search and nothing lower. I have created an index like so:
{
"settings": {
"analysis": {
"analyzer": {
"occupation_hierarchy_analyzer": {
"tokenizer": "path_hierarchy"
}
}
}
},
"mappings": {
"category": {
"properties": {
"path": {
"type": "text",
"analyzer": "occupation_hierarchy_analyzer"
}
}
}
}
}
Then I'm adding a set of categories with increasing depth:
{"index": {"_index": "occupations", "_type": "category"}}
{"path": "/","name": "Business, finance and administration occupations"}
{"index": {"_index": "occupations", "_type": "category"}}
{"path": "/Business, finance and administration occupations","name": "Senior financial administrator"}
{"index": {"_index": "occupations", "_type": "category"}}
{"path": "/Business, finance and administration occupations/Senior financial administrator","name": "Senior finance operator"}
{"index": {"_index": "occupations", "_type": "category"}}
{"path": "/Business, finance and administration occupations/Senior financial administrator/Senior finance operator","name": "Senior bank manager"}
Now my query looks like so:
{
"query": {
"bool": {
"filter": {
"term":{
"path": "/Business, finance and administration occupations"
}
}
}
}
}
This query returns all documents within that path and it's sub-paths. What I'd like is just the documents within the given path and none from a lower depth. I've searched all around, but I have yet to see a way to do this. I read documentation here: https://www.elastic.co/guide/en/elasticsearch/guide/master/denormalization-concurrency.html, which seemed to indicate the above query would only search for documents at that depth.
Any insight is greatly appreciated!