Elasticsearch のファセット機能を使用して、単語とフレーズのタグクラウドを作成しようとしています。
私のマッピング:
curl -XPOST http://localhost:9200/myIndex/ -d '{
...
"analysis":{
"filter":{
"myCustomShingle":{
"type":"shingle",
"max_shingle_size":3,
"output_unigrams":true
}
},
"analyzer":{ //making a custom analyzer
"myAnalyzer":{
"type":"custom",
"tokenizer":"standard",
"filter":[
"lowercase",
"myCustomShingle",
"stop"
]
}
}
}
...
},
"mappings":{
...
"description":{ //the field to be analyzed for making the tag cloud
"type":"string",
"analyzer":"myAnalyzer",
"null_value" : "null"
},
...
}
ファセットを生成するためのクエリ:
curl -X POST "http://localhost:9200/myIndex/myType/_search?&pretty=true" -d '
{
"size":"0",
"query": {
match_all:{}
},
"facets": {
"blah": {
"terms": {
"fields" : ["description"],
"exclude" : [ 'evil' ], //remove facets that contain these words
"size": "50"
}
}
}
}
私の問題は、「ファセット」の「除外」オプションに「悪」という単語を挿入すると、「悪」に一致する単語(またはシングルシングル)を含むファセットが正常に削除されることです。しかし、2/3 の単語帯状疱疹、「バイオハザード」、「邪悪なコンピューター」、「私の邪悪な猫」は削除されません。「除外単語」を含むフレーズのファセットを削除するにはどうすればよいですか?