https://gist.github.com/3442562の完全な要旨
私はアナライザーを持っています:
"analyzer" : {
"lowercase_keyword" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : ["lowercase", "trim"]
}
}
マッピングで参照されている:
"location_countries" : {
"properties" : {
"country" : {
"type" : "string",
"analyzer" : "lowercase_keyword"
}
}
}
また、フィルターまたはファセットで「国」フィールドを使用すると、フィールドは (正しく) キーワードとして扱われます。
curl -XGET 'localhost:9200/clinical_trials/_search?pretty=true' -d '
{
"query" : {
"term" : { "brief_title" : "dermatitis" }
},
"filter" : {
"term" : { "country" : "united states" }
},
"facets" : {
"tag" : {
"terms" : { "field" : "country" }
}
}
}
'
ファセット結果:
"facets" : {
"tag" : {
"_type" : "terms",
"missing" : 0,
"total" : 1,
"other" : 0,
"terms" : [ {
"term" : "united states",
"count" : 1
} ]
}
マシンが再起動されるか、Elastic Search サービスが再起動されるまで、すべてが正常に機能します。再起動後、アナライザーが存在しないかのようにすべてのフィルターが機能しなくなります。
同じデータに対して同じクエリを実行すると、次のようになります。
"facets" : {
"tag" : {
"_type" : "terms",
"missing" : 0,
"total" : 2,
"other" : 0,
"terms" : [ {
"term" : "united",
"count" : 1
}, {
"term" : "states",
"count" : 1
} ]
}
インデックスの _settings/_mappings を照会すると、アナライザーとマッピングは正しく定義されていますが、アナライザーは効果がないようです。
私は何を間違っていますか?
前もって感謝します!