Вы можете использовать токенайзер иерархии путей, установив в качестве разделителя обратную косую черту sh - введите c здесь Попробуйте:
PUT my_index
{
"settings": {
"analysis": {
"analyzer": {
"custom_path_tree": {
"tokenizer": "custom_hierarchy"
},
"custom_path_tree_reversed": {
"tokenizer": "custom_hierarchy_reversed"
}
},
"tokenizer": {
"custom_hierarchy": {
"type": "path_hierarchy",
"delimiter": "\"
},
"custom_hierarchy_reversed": {
"type": "path_hierarchy",
"delimiter": "\",
"reverse": "true"
}
}
}
},
"mappings": {
"properties": {
"file_path": {
"type": "text",
"fields": {
"tree": {
"type": "text",
"analyzer": "custom_path_tree"
},
"tree_reversed": {
"type": "text",
"analyzer": "custom_path_tree_reversed"
}
}
}
}
}
}
POST my_index/_analyze
{
"analyzer": "custom_path_tree",
"text": "C:\Windows\Users"
}