为了配置自定义的analyzer,辗转许久终于找到方法

我个人是在虚拟机上安装的kibana服务里那个dev tools里操作的,如下

PUT /africa_test/
{
  "settings": {
    "analysis": {
      "filter": {
        "english_stop": {
          "type":       "stop",
          "stopwords":  "_english_"
        },
        "hunspell_en_US": {
          "type":       "hunspell",
          "language":   "en_US" 
        }
      },
      "analyzer": {
        "english": {
          "tokenizer":  "standard",
          "filter": [
            "lowercase",
            "english_stop",
            "hunspell_en_US", 
            "asciifolding" 
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
        "myid":{"type":"keyword",
                "index": true
                },
        "question": {"type": "text",
                     "index": true,
                     "analyzer": "english",
                     "search_analyzer": "english"
                     },
        "accuratequestion": {"type": "text"
                             },
        "questionfh1": {"type": "text",
                        "index": true,
                        "analyzer": "english",
                        "search_analyzer": "english"

                        },
        "questionfh2": {"type": "text",
                        "index": true,
                        "analyzer": "english",
                        "search_analyzer": "english"
                        },
        "answer": {"type": "text"
                   },
        "source": {"type": "text",
                    "fields": {
			            "keyword": { 
			              "type": "keyword"
			            }
			        }
        },         
        "subject": {"type": "text",
                    "fields": {
			            "keyword": { 
			              "type": "keyword"
			            }
			        }
        }
    }
  }
}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐