Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

每次创建索引远程加载文件会请求两次 #103

Open
foxli91 opened this issue Mar 9, 2022 · 3 comments
Open

每次创建索引远程加载文件会请求两次 #103

foxli91 opened this issue Mar 9, 2022 · 3 comments

Comments

@foxli91
Copy link

foxli91 commented Mar 9, 2022

我创建了一个同义词索引编译后部署到自己的服务器测试发现创建索引的时候对于同一个远程文件每次会请求两次,以至于后续每隔一段时间也请求两次,看了源码不知从何下手,作者能测试一下吗?我的es 版本是 7.8.1

PUT house_info3
{
  "settings": {
    "analysis": {
      "analyzer": {
        "demo_name2pinyin_analyzer": {
          "type": "custom",
          "tokenizer": "ik_max_word",
          "filter": [
            "demo_name2pin_yin"
          ]
        },
        "my_synonyms_analyzer": {
          "filter": [
            "my_synonym_filter"
          ],
          "type": "custom",
          "tokenizer": "ik_max_word"
        },
        "myremote_synonyms_analyzer": {
          "filter": [
            "my_remote_filter"
          ],
          "type": "custom",
          "tokenizer": "ik_max_word"
        }
      },
      "filter": {
        "my_synonym_filter": {
          "type": "synonym",
          "synonyms_path": "tongyicianalysis/synonyms.txt",
          "updateable": "true"
        },
        "my_remote_filter": {
          "type": "dynamic_synonym",
          "synonyms_path": "http://172.16.21.87:8092/tongyici/getTongYiCi",
          "interval": 60
        },
        "demo_name2pin_yin": {
          "type": "pinyin",
          "keep_separate_first_letter": "true",
          "keep_joined_full_pinyin": "true",
          "keep_none_chinese_in_joined_full_pinyin": "true",
          "none_chinese_pinyin_tokenize": "true",
          "keep_original": "true"
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "demo_name2pinyin_analyzer",
        "fields": {
          "chinese": {
            "type": "text",
            "analyzer": "ik_max_word",
            "search_analyzer": "myremote_synonyms_analyzer"
          }
        },
        "search_analyzer": "demo_name2pinyin_analyzer"
      },
      "created": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss"
      }
    }
  }
}
[2022-03-09T17:48:14,400][INFO ][stdout                   ] [zhineng-1] ====================添加监听成功====================
[2022-03-09T17:48:14,647][INFO ][dynamic-synonym          ] [zhineng-1] start reload remote synonym from http://172.16.21.87:8092/tongyici/getTongYiCi.
[2022-03-09T17:48:14,867][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 成都,成都市,蓉城,天府之国,西南第一城
[2022-03-09T17:48:14,867][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 西红柿,番茄,圣女果
[2022-03-09T17:48:14,867][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 土豆,马铃薯,洋芋,薯片
[2022-03-09T17:48:14,867][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 测试,测试1,测试2
[2022-03-09T17:48:14,868][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 黄河水,yellow river ,哈哈哈哈,测试
[2022-03-09T17:48:14,868][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 黄河,yellow river ,哈哈哈哈
[2022-03-09T17:49:14,409][INFO ][dynamic-synonym          ] [zhineng-1] start reload remote synonym from http://172.16.21.87:8092/tongyici/getTongYiCi.
[2022-03-09T17:49:14,634][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 成都,成都市,蓉城,天府之国,西南第一城
[2022-03-09T17:49:14,634][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 西红柿,番茄,圣女果
[2022-03-09T17:49:14,634][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 土豆,马铃薯,洋芋,薯片
[2022-03-09T17:49:14,635][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 测试,测试1,测试2
[2022-03-09T17:49:14,635][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 黄河水,yellow river ,哈哈哈哈,测试
[2022-03-09T17:49:14,635][INFO ][dynamic-synonym          ] [zhineng-1] reload remote synonym: 黄河,yellow river ,哈哈哈哈
@licdatgithub
Copy link

我的也是这样,加载了好多次

@liguanqiao
Copy link

我调试了一下,发现在创建索引的时候,会执行两遍 DynamicSynonymTokenFilterFactory::new,导致重复创建了定时任务,不知道为啥会触发两次new

@liguanqiao
Copy link

我调试了一下,发现在创建索引的时候,会执行两遍 DynamicSynonymTokenFilterFactory::new,导致重复创建了定时任务,不知道为啥会触发两次new

ES版本8.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants