我在我的集群里面做了一个测试,当我把同义词字典加入以后,我在做全文检索的时候, query的时间明显变长了。
总文档数也就是 45万,5个多G的测试数据。生产上面有150多个G的数据
我的mapping是这么定义:
 
同义词字典是:
西红柿,番茄
土豆,马铃薯,薯片
蜂蜜,蜜蜂
类似于这样子的格式
 
然后我用最简单的query:
在我的index_A有同义词的下面,query一次要6s
 
在我的index_B没有同义词的下面,query一次要0.8s
 
请问一下 这个要怎么优化呢?
																																																
															
														总文档数也就是 45万,5个多G的测试数据。生产上面有150多个G的数据
我的mapping是这么定义:
{
  "settings": {
    "number_of_replicas": 0,
    "number_of_shards": 3,
    "index": {
      "analysis": {
        "analyzer": {
          "ik_mword_analyzer": {
            "type": "custom",
            "tokenizer": "ik_max_word",
            "filter": [
              "my_synonym_filter"
            ]
          },
          "ik_smart_analyzer": {
            "type": "custom",
            "tokenizer": "ik_smart",
            "filter": [
              "my_synonym_filter"
            ]
          }
        },
        "filter": {
          "my_synonym_filter": {
            "type": "synonym",
            "synonyms_path": "analysis-ik/synonyms.txt"
          }
        }
      }
    }
  },
    "mappings": {
    "news": {
      "properties":{
        "title":{
          "type": "text",
          "similarity": "BM25",
          "index_options" : "offsets",
          "store": true,
          "copy_to": "fullcontent",
          "analyzer": "ik_max_word"
        },
        "author_level":{
          "type": "text",
          "similarity": "BM25",
          "store": true,
          "fielddata": true,
          "copy_to": "fullcontent",
          "analyzer": "ik_smart"
        },
        "article_content":{
          "type": "text",
          "store": true,
          "fielddata": true,
          "copy_to": "fullcontent",
          "analyzer": "ik_max_word"
        },
        "fullcontent":{
          "type": "text",
          "store": true,
          "fielddata": true,
          "copy_to": "fullcontent",
          "index_options" : "offsets",
          "analyzer": "ik_max_word"
        }
}同义词字典是:
西红柿,番茄
土豆,马铃薯,薯片
蜂蜜,蜜蜂
类似于这样子的格式
然后我用最简单的query:
{
  "query": {
    "match_phrase": {
      "fullcontent": "西红柿"
    }
  }
}在我的index_A有同义词的下面,query一次要6s
在我的index_B没有同义词的下面,query一次要0.8s
请问一下 这个要怎么优化呢?



 
	
3 个回复
rochy - rochy_he
赞同来自:
JackGe
赞同来自:
liubin
赞同来自: