各类语种分词器

各类语种分词器 #

Easysearch 在分词器选项中支持以下语种:阿拉伯语(arabic)、亚美尼亚语(armenian)、巴斯克语(basque)、孟加拉语(bengali)、巴西葡萄牙语(brazilian)、保加利亚语(bulgarian)、加泰罗尼亚语(catalan)、捷克语(czech)、丹麦语(danish)、荷兰语(dutch)、英语(english)、爱沙尼亚语(estonian)、芬兰语(finnish)、法语(french)、加利西亚语(galician)、德语(german)、希腊语(greek)、印地语(hindi)、匈牙利语(hungarian)、印度尼西亚语(indonesian)、爱尔兰语(irish)、意大利语(italian)、拉脱维亚语(latvian)、立陶宛语(lithuanian)、挪威语(norwegian)、波斯语(persian)、葡萄牙语(portuguese)、罗马尼亚语(romanian)、俄语(russian)、索拉尼语(sorani)、西班牙语(spanish)、瑞典语(swedish)、土耳其语(turkish)以及泰语(thai)。

当你映射索引时要使用该分词器,需在查询中指定相应的值。例如,要使用法语语种分词器来映射您的索引,为分词器字段指定值 french

 "analyzer": "french"

参考样例 #

以下请求指定了一个名为 my-index 的索引,其中 content 字段被配置为多字段,并且一个名为 french 的子字段配置了french语种分词器

PUT my-index
{
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "fields": {
          "french": {
            "type": "text",
            "analyzer": "french"
          }
        }
      }
    }
  }
}

也可以使用以下查询为整个索引配置默认的french分词器:

PUT my-index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "french"
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text"
      },
      "title": {
        "type": "text"
      },
      "description": {
        "type": "text"
      }
    }
  }
}