Stempel Polish Analysis Plugin 作为 Elasticsearch 的插件不起作用

Stempel Polish Analysis Plugin as plugin to Elasticsearch doesn't work

下面的例子是在 es 2.3 和 1.7 上调用的。

起初我安装了插件:https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-stempel.html#analysis-stempel

接下来我的步骤是检查正确安装的插件: 我屏幕上的结果:

Installed plugins in /home/adam/Desktop/elasticsearch-2.3.0/plugins:
- analysis-stempel
- marvel-agent
- license

接下来我为博客添加了映射:

curl -XPUT localhost:9200/my_index -d '{ 
 "mappings": {
    "blog": {
      "properties": {
        "title": { 
          "type": "string",
          "fields": {
            "polish": { 
              "type":     "string",
              "analyzer": "polish"
            }
          }
        }
      }
    }
  }
}
'

然后我添加了文档:

curl -XPUT localhost:9200/my_index/blog/1 -d
'{ "title": "Bardzo kocham zółwie"}'

当我使用:

curl -XGET localhost:9200/_search -d
'{
  "query": {
    "multi_match": {
      "type":     "most_fields", 
      "query":    "zółwie",
      "fields": [ "title", "title.polish" ]
    }
  }
}
'

Elasticsearch returns 正确的结果但是如果我输入:

curl -XGET localhost:9200/_search -d
'{
  "query": {
    "multi_match": {
      "type":     "most_fields", 
      "query":    "zolwie",
      "fields": [ "title", "title.polish" ]
    }
  }
}'

没有 Elasticsearch returns。

波兰语特殊字符有问题。

第二个查询需要的是asciifolding token filter。我会建议以下映射,以涵盖更多用例:

{
  "settings": {
    "analysis": {
      "analyzer": {
        "folding": {
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "blog": {
      "properties": {
        "title": {
          "type": "string",
          "fields": {
            "folding": {
              "type": "string",
              "analyzer": "folding"
            },
            "polish": {
              "type": "string",
              "analyzer": "polish"
            }
          }
        }
      }
    }
  }
}

这个查询:

{
  "query": {
    "multi_match": {
      "type": "most_fields",
      "query": "zolwie",
      "fields": [
        "title.*"
      ]
    }
  }
}