我相信您的问题是这些
analysis设置需要嵌套在
settingsJSON的一个
index节点内,而不是您所拥有的嵌套在一个节点内。请参考Elasticsearch
Create Index
API,以获取有关构造JSON的详细信息。
因此,您的创建索引调用应如下所示:
curl -X PUT "http://localhost:9200/$INDEX_NAME/" -d '{ "settings":{ "analysis":{ "analyzer":{ "analyzer1":{ "type":"custom", "tokenizer":"standard", "filter":[ "standard", "lowercase", "stop", "kstem", "ngram" ] } }, "filter":{ "ngram":{ "type":"ngram", "min_gram":2, "max_gram":15 } } } }, "mappings": { "product": { "properties": { "title": { "type": "string", "search_analyzer" : "analyzer1", "index_analyzer" : "analyzer1" } } } }}';


