elasticsearch 在OpenSearch模板中创建不可搜索的字段

bpzcxfmw  于 7个月前  发布在  ElasticSearch
关注(0)|答案(1)|浏览(72)

我有以下模板配置:

{
  "properties": {
    "source": {
      "fields": {
        "keyword": {
          "ignore_above": 256,
          "type": "keyword"
        }
      },
      "type": "text"
    },
    "application_name": {
      "fields": {
        "keyword": {
          "ignore_above": 256,
          "type": "keyword"
        }
      },
      "type": "text"
    },
    "message": {
      "fields": {
        "keyword": {
          "ignore_above": 256,
          "type": "keyword"
        }
      },
      "type": "text"
    }
  }
}

字符串
我想创建不可搜索的字段,例如application_name。我试图添加enabled: false,但这不起作用。如何在模板中创建不可搜索的字段?

s3fp2yjn

s3fp2yjn1#

如果你想让你的文本字段不可搜索,你需要使用index mapping parameter并将其设置为false(默认为true):

"application_name": {
  "type": "text",
  "index": false
},

字符串

相关问题