Elasticsearch中具有多个标记的全文本搜索

时间:2018-11-30 21:52:26

标签: elasticsearch elasticsearch-6

鉴于我有多个文档,其中包含一个句子,例如“欢迎您今天过得好吗?”我应用了simple_query_string查询来搜索上述句子。首次使用welcome to how时。它返回0命中。但是,当我使用how are you doing today时,它会显示所有文档。有人可以告诉我是什么原因造成的吗?

查询就像:

查询:{     simple_query_string:{                             查询:'\欢迎使用\',                             字段:['content'],                             default_operator:“ AND”}                        }

分析仪的设置为:

{
  "number_of_shards": 2,
  "refresh_interval": "30s",
  "analysis": {
    "filter": {
      "autocomplete_filter": {
        "type": "edge_ngram",
        "min_gram": 1,
        "max_gram": 20
      }
    },
    "analyzer": {
      "charSplit": {
        "type": "custom",
        "tokenizer": "ngram_tokenizer",
        "char_filter": [
          "my_char_filter"
        ],
        "filter": [
          "lowercase",
          "autocomplete_filter"
        ]
      }
    },
    "tokenizer": {
      "ngram_tokenizer": {
        "type": "nGram",
        "min_gram": "1",
        "max_gram": "1"
      }
    },
    "char_filter": {
      "my_char_filter": {
        "type": "mapping",
        "mappings": "specialCharacters"
      }
    }
  }
}

0 个答案:

没有答案