elasticsearch - 映射不适用于elasticsearch中的字段

标签 elasticsearch lucene

我将映射映射到字段question_title,其内容如下:

PUT mac/_settings
{
  "mappings": {
    "ask_expert_published_prod": {
      "properties": {
        "question_title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
  }
}

但是,当我通过以下方式看到类型的映射时:
GET myindex/mytype/_mapping

它仍然只为该字段显示type ='string',如下所示:
"question_title": {
                  "type": "string"
               },

映射是否在现场正确更新。如果没有,我该怎么办。

最佳答案

在您的初始命令中,从路径中删除_settings,因为它仅用于更新索引设置而不是映射。

只需运行以下命令:

PUT mac
{
  "mappings": {
    "ask_expert_published_prod": {
      "properties": {
        "question_title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
  }
}

关于elasticsearch - 映射不适用于elasticsearch中的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36061652/

相关文章:

elasticsearch - 索引(ES 7)允许的最大字段数是多少?

Lucene 查询解析器

elasticsearch - 使用来自不同索引的数据进行 Elasticsearch 计算

elasticsearch - 如何在Elasticsearch中组合多个aggs?

java - 将 map 复制到 Elasticsearch 更新文档请求中

java - 对于谷歌应用程序引擎: Compare and Contrast Lucene and Search Api

apache - grails如何在领域类别中进行搜索

spring - @IndexedEmbedded 在延迟加载的实体列表上,不会自动进入搜索索引

elasticsearch - 如何获取与hibernate搜索结果列表相关的对象?

elasticsearch - Elasticsearch多索引查询