0

私が持っているように、私はこのような動的テンプレートを作成しましたdynamic types:

{
  "template": "test-*", //match any index that starts with 'test-'
  "settings": {
    "number_of_shards": 5
  },
  "mappings": {
    "_default_": {
      "_all": {
        "enabled": false
      },
      "dynamic_templates": [
        {
          "test_id": {
            "match": "test_id", // This is an Array of strings field ["a","b"]
            "mapping": {
              "type": "string",
              "index": "not_analyzed"
            }
          }
        },
        {
          "branch_id": {
            "match": "branch_id", // This is Array of objects field [{"a": "b"}, {"c": "d"}]
            "mapping": {
              "type": "string",
              "index": "not_analyzed"
            }
          }
        }
      ]
    }
  }
}

文書例:

{
  "_index": "test-data13",
  "_type": "025e179ccfd79cacd92f61bb17bddcf8abf83dc2",
  "_id": "847",
  "_version": 1,
  "_score": 1,
  "_source": {
    "test_id": [
      "test_id_test_10123" // disable indexing or full text search for this Array of string
    ],
    "branch_id": [ // disable indexing or full text search for this Array of hashes
      {
        "1": "test_id_test_10123"
      },
      {
        "2": "test_id_test_10124"
      }
    ]
  }
}

このテンプレートを変更して、値を持つtest_idフィールドとbranch_idフィールドがインデックス化または分析されないようにする方法は? not_analyzed値が配列とオブジェクトの配列の場合に機能しますか?

4

1 に答える 1

1

インデックスオプションを に設定しno有効falseすると、test_id配列とbranch_idオブジェクトにインデックスが付けられなくなります。

例:

{
   "template": "test-*",
   "settings": {
      "number_of_shards": 5
   },
   "mappings": {
      "_default_": {
         "_all": {
            "enabled": false
         },
         "dynamic_templates": [
            {
               "test_id": {
                  "match": "test_id",
                  "mapping": {
                     "index": "no"
                  }
               }
            },
            {
               "branch_id": {
                  "match": "branch_id",
                  "mapping": {
                     "index": "no",
                     "enabled": false
                  }
               }
            }
         ]
      }
   }
}
于 2016-09-07T22:06:51.817 に答える