Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Elasticsearch未返回具有相同令牌的结果?_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Search_Token - Fatal编程技术网 elasticsearch Elasticsearch未返回具有相同令牌的结果?,elasticsearch,search,token,elasticsearch,Search,Token" /> elasticsearch Elasticsearch未返回具有相同令牌的结果?,elasticsearch,search,token,elasticsearch,Search,Token" />

elasticsearch Elasticsearch未返回具有相同令牌的结果?

elasticsearch Elasticsearch未返回具有相同令牌的结果?,elasticsearch,search,token,elasticsearch,Search,Token,ElasticSearch中插入的数据是韩语的,所以我不能给出确切的情况,但让我们假设一下 我有一个单词ABBCC,标记为[“a”,“BBCC”],另一个单词AZZXXX标记为[“a”,“ZZXXX”] 如果我搜索ABBCC,那么AZZXXX是否应该出现,因为它们有相同的令牌?或者这不是elasticsearch的工作方式 这就是我检查分析单词的方式: GET recpost_test/_analyze { "analyzer": "my_analyzer", "text":"my qu

ElasticSearch中插入的数据是韩语的,所以我不能给出确切的情况,但让我们假设一下 我有一个单词
ABBCC
,标记为
[“a”,“BBCC”]
,另一个单词
AZZXXX
标记为
[“a”,“ZZXXX”]

如果我搜索ABBCC,那么AZZXXX是否应该出现,因为它们有相同的令牌?或者这不是elasticsearch的工作方式

这就是我检查分析单词的方式:

GET recpost_test/_analyze
{
  "analyzer": "my_analyzer",
  "text":"my query String!" 
}
以下是我创建索引的方式:

PUT recpost
{
  "settings": {
    "index": {
      "analysis": {
        "tokenizer": {
          "nori_user_dict": {
            "type": "nori_tokenizer",
            "decompound_mode": "mixed",
            "user_dictionary": "userdict_ko.txt"
          }
        },
        "analyzer": {
          "my_analyzer": {
            "type": "custom",
            "tokenizer": "nori_user_dict"
          }
        },
        "filter": {
        "substring": {
          "type": "edgeNGram",
          "min_gram": 1,
          "max_gram": 10
        }
      }
      }
    }
  }
}
我是这样搜索的:

GET recpost/_search
{
  "_source": [""],
  "from": 0,
  "size": 2,
  "query":{
    "multi_match": {
      "query" : "my query String!",
      "type": "best_fields", 
      "fields" : [
        "brandkor",
        "content",
        "itemname",
        "name",
        "review",
        "shortreview^2",
        "title^3"]
    }
  }
}

编辑: 我尝试添加“analyzer”字段进行搜索,但仍然不起作用

GET recpost/_search
{
  "_source": [""],
  "from": 0,
  "size": 2,
  "query":{
    "multi_match": {
      "query" : "깡스",
      "analyzer": "my_analyzer", 
      "type": "best_fields", 
      "fields" : [
        "brandkor",
        "content",
        "itemname",
        "name",
        "review",
        "shortreview^2",
        "title^3"]
    }
  }
}
EDIT2:这是我的映射:

{
  "recpost_test" : {
    "mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "brandkor" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "content" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "field_statistics" : {
          "type" : "boolean"
        },
        "fields" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "itemname" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "name" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "offsets" : {
          "type" : "boolean"
        },
        "payloads" : {
          "type" : "boolean"
        },
        "positions" : {
          "type" : "boolean"
        },
        "review" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "shortreview" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "term_statistics" : {
          "type" : "boolean"
        },
        "title" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    }
  }
}

我没有看到您将字段装入索引(映射)。 因此,据我所知,您正在将所有字段(brandkor、content等)索引为
文本。。基本上你是在匹配精确的值


除非您将每个字段与其分析器关联。

您应该在多重匹配中使用您的分析器,不是吗?@baitmbarek我尝试设置分析器(添加为编辑)仍然不起作用。尝试“tie_breaker:1.0”我想如果我在创建索引时设置分析器,它将使用该分析器作为默认值来分析文本字段。不是这样吗?用我的自定义分析器重新创建了索引和映射的文本字段,现在可以工作了!谢谢