This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Elascticsearch Directories ideas
Corentin Chary edited this page Jul 24, 2018
·
2 revisions
Problem: With current solution, foo.{a,b}.. returns ['foo.{a,b}..a', 'foo.{a,b}..b'] instead of expanded paths
Solutions:
- Be ok with that, but fix the post-filtering
- Add directories (but deal with deletions, creations, inconsistencies).
- Expand variants by hand (with should mostly work)
POST _analyze
{
"tokenizer": {
"type": "path_hierarchy",
"delimiter": "."
},
"text": "one.two.three"
}
DELETE cchary_test
PUT /cchary_test
{
"settings": {
"analysis": {
"analyzer": {
"path-analyzer": {
"type": "custom",
"tokenizer": "path-tokenizer"
}
},
"tokenizer": {
"path-tokenizer": {
"type": "path_hierarchy",
"delimiter": "."
}
}
}
},
"mappings": {
"_doc": {
"dynamic": "true",
"properties": {
"path": {
"type": "keyword",
"fields": {
"tree": {
"type": "text",
"analyzer": "path-analyzer",
"fielddata": true
}
}
}
}
}
}
}
GET cchary_test
GET cchary_test/_doc/1
GET cchary_test/_search
{
"query": {
"bool": {
"filter" : {
"term" : {
"path.tree": "one"
}
}
}
}
}
GET cchary_test/_search
{
"size": 0,
"aggs": {
"paths": {
"terms": {
"field": "path.tree"
}
}
}
}
PUT /cchary_test/_doc/1
{
"name": "test",
"path": "one.two.three.four.five"
}
POST cchary_test/_analyze
{
"analyzer": "my_analyzer",
"text": "one.two.three.four.five"
}