[英]Adding uax_url_email analyzer to Elasticsearch 2.4.5
I'm trying to add an analyzer that uses the uax_url_email
tokenizer. 我正在尝试添加一个使用uax_url_email
标记生成器的分析器 。
▶ elasticsearch --version
Version: 2.4.5, Build: c849dd1/2017-04-24T16:18:17Z, JVM: 1.8.0_131
curl -XPUT http://localhost:9200/timeline -H 'Content-Type: application/json' -d'
{
"settings": {
"analysis": {
"analyzer": {
"email_analyzer": {
"type": "custom",
"tokenizer": "uax_url_email"
}
}
}
}
}'
However this complains that the index already exists. 但是,这抱怨该索引已经存在。
{
"error": {
"index": "timeline",
"reason": "already exists",
"root_cause": [
{
"index": "timeline",
"reason": "already exists",
"type": "index_already_exists_exception"
}
],
"type": "index_already_exists_exception"
},
"status": 400
}
So I tried doing an update via PATCH
所以我尝试通过PATCH
进行更新
curl -XPATCH http://localhost:9200/timeline -H 'Content-Type: application/json' -d'
{
"settings": {
"analysis": {
"analyzer": {
"email_analyzer": {
"type": "custom",
"tokenizer": "uax_url_email"
}
}
}
}
}'
This doesn't complain about any issues, returns no errors and the returned output is the same as if I'd issued a GET
request to the /timeline
index 这不会抱怨任何问题,不会返回任何错误,并且返回的输出与我向/timeline
索引发出GET
请求/timeline
The interesting part of the output is that the settings haven't updated. 输出的有趣之处在于设置尚未更新。
"settings": {
"index": {
"creation_date": "1497609042039",
"number_of_replicas": "1",
"number_of_shards": "5",
"uuid": "XaRS0KN1SLWcBsl6eLMZcg",
"version": {
"created": "2040599"
}
}
},
I perhaps wrongly would expect the newly PATCHED
analysis object to be present... 我可能错误地期望新的PATCHED
分析对象存在...
Not sure where I'm going wrong here. 不知道我在哪里错了。
You need to first close the index and then open it again: 您需要首先关闭索引,然后再次打开它:
curl -XPOST 'localhost:9200/timeline/_close'
curl -XPUT 'localhost:9200/timeline/_settings' -d '{
"analysis" : {
"analyzer":{
"email_analyzer":{
"type":"custom",
"tokenizer":"uax_url_email"
}
}
}
}'
curl -XPOST 'localhost:9200/timeline/_open'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.