How to Query path_hierarchy tokenized field


(Jan Jakubcik) #1

I have serveral hundred objects with path information something like:

{
  "id": "9",
  "metadata": [
    {
      "5": "C:/GIT/test-data/create/output/dataset_2/AX_0004"
    }
  ]
}

I have following mapping:

{
    "domain-0": {
        "mappings": {
            "pool_document": {
                "dynamic": "false",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "metadata": {
                        "type": "nested",
                        "properties": {
                            "5": {
                                "type": "text",
                                "analyzer": "file_path"
                            }
                        }
                    }
                }
            }
        },
        "settings": {
            "index": {
                "number_of_shards": "5",
                "provided_name": "domain-01517314872971",
                "creation_date": "1517314872960",
                "analysis": {
                    "analyzer": {
                        "file_path": {
                            "filter": [
                                "lowercase",
                                "asciifolding"
                            ],
                            "type": "custom",
                            "tokenizer": "path_hierarchy"
                        }
                    }
                },
                "number_of_replicas": "1",
                "uuid": "x2qdGTCxT5G_RXXUBgmZgQ",
                "version": {
                    "created": "5050099"
                }
            }
        }
    }
}

I want to query this field for exact match:

{
  "query": {
    "match": {
      "metadata.5": "Y:/SpecialData/CrossBUStability/MR/1_MR PET/HEAD_EP2D_DIFF_STIR_B50_800_P2_ADC_0045"
    }
  }
}

Which does not return any result. The same is for term query.
The only query that does work for me, but does not return exact match is

{
  "query": {
    "query_string": {
      "query": "Y://SpecialData//CrossBUStability//MR/1_MR-PET/HEAD_EP2D_DIFF_STIR_B50_800_P2_ADC_0045"
    }
  }
}

How should I change the mapping or query to get exact match for path?


(system) #2

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