elasticsearch - 如何更新ElasticSearch search_analyzer映射而在分析器上没有冲突?

标签 elasticsearch configuration lucene elasticsearch-7

我正在使用7.7版的ElasticSearch,LogStash和Kibana,并尝试更新字段的索引映射会导致2个错误之一:

  • mapper_parsing_exception: analyzer on field [title] must be set when search_analyzer is set
  • illegal_argument_exception: Mapper for [title] conflicts with existing mapping:\n[mapper [title] has different [analyzer]]

  • 这是我正在尝试的操作。如果删除"analyzer": "standard",则会出现第一个错误。如果我将其保留,则会出现第二个错误。
    PUT /my_index/_mapping
    {
      "properties": {
        "title": {
          "type": "text",
          "analyzer": "standard",
          "search_analyzer": "synonyms"
        }
      }
    }
    

    但是,当我使用GET /my_index/_mapping获得映射时,没有看到定义的任何分析器:
    "title" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    

    额外信息

    这是我设置“同义词”搜索分析器的方法,但我认为这并不相关:
    POST /my_index/_close
    PUT /my_index/_settings
    {
      "index": {
        "analysis": {
          "analyzer": {
            "synonyms": {
              "tokenizer": "whitespace",
              "filter": [
                "lowercase",
                "the_synonyms"
              ]
            }
          },
          "filter": {
            "the_synonyms": {
              "type": "synonym",
              "synonyms_path": "the_synonyms.txt",
              "updateable": true
            }
          }
        }
      }
    }
    POST /my_index/_open
    

    最佳答案

    以下作品。不确定以这种方式进行操作会有任何影响。我不这么认为,但是除了指出standard分析器是默认分析器的文档之外,我也找不到关于它的任何文档。我基本上是通过猜测找到答案的。

    PUT /my_index/_mapping
    {
      "properties": {
        "title": {
          "type": "text",
          "analyzer": "default",
          "search_analyzer": "synonyms"
        }
      }
    }
    

    关于elasticsearch - 如何更新ElasticSearch search_analyzer映射而在分析器上没有冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62307234/

    相关文章:

    lucene - 按关键/特定字段限制 couchdb-lucene 结果? map ?

    php - Elasticsearch - 希望在该特定字段可用或不可用的所有索引中按字段排序,如果不可用,则避免它

    elasticsearch - 无法使用Java API和Shield连接到ElasticSearch服务器

    ruby-on-rails - ElasticSearch和 cucumber

    elasticsearch - 在Elasticsearch聚合中每个存储桶获取一个文档

    php - 是什么导致 CPU 负载如此之高(来自 MySQL)?

    lucene - 如何查找相似文档

    configuration - HAProxy 的热重新配置仍然导致请求失败,有什么建议吗?

    java - 如何确保在开始返回 bean 之前将资源注入(inject)到我的配置中?

    api - 使用 Lucene API 显示来自 Solr 索引的浮点字段