ElasticSearch Path Hierarchy Tokenizer Aggregation

I'm going with the this example here.

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pathhierarchy-tokenizer-examples.html#analysis-pathhierarchy-tokenizer-examples

My mapping code is below:

    PUT file-path-test
    {
      "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 file-path-test/_doc/1
    {
      "file_path": "/User/alice/photos/2017/05/16/my_photo1.jpg"
    }

    POST file-path-test/_doc/2
    {
      "file_path": "/User/alice/photos/2017/05/16/my_photo2.jpg"
    }

    POST file-path-test/_doc/3
    {
      "file_path": "/User/alice/photos/2017/05/16/my_photo3.jpg"
    }

    POST file-path-test/_doc/4
    {
      "file_path": "/User/alice/photos/2017/05/15/my_photo1.jpg"
    }

    POST file-path-test/_doc/5
    {
      "file_path": "/User/bob/photos/2017/05/16/my_photo1.jpg"
    }

The query below seems empty.

    GET / file-path-test / _search
    {
      
       "aggs": {
         "FILTER": {
           "terms": {
             "field": "file_path."
           }
         }
       }
    }

Response:

    "aggregations": {
         "FILTER": {
           "doc_count_error_upper_bound": 0,
           "sum_other_doc_count": 0,
           "buckets": []
         }
       }

What is the reason?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.