[PATCH compass-ci] sbin/es-jobs-mapping.sh: disable default dynamic mapping

[why] By default, fields can be added dynamically to a document, or to inner objects within a document, just by indexing a document containing the new field. However, there are many fields that we do not need, and "Limit of total fields [1000] in index [jobs] has been exceeded" exception will be reported when the number of fields exceeds 1000. [how] Disable default dynamic mapping. Signed-off-by: Zhang Yuhang <zhangyuhang25@huawei.com> --- sbin/es-jobs-mapping.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sbin/es-jobs-mapping.sh b/sbin/es-jobs-mapping.sh index 9d420f7..076bdd3 100755 --- a/sbin/es-jobs-mapping.sh +++ b/sbin/es-jobs-mapping.sh @@ -38,6 +38,7 @@ else curl -H 'Content-Type: Application/json' -XPUT 'http://localhost:9200/jobs' -d '{ "mappings": { "_doc": { + "dynamic": false, "dynamic_templates": [ { "pp": { @@ -61,6 +62,10 @@ else } ], "properties": { + "pp": { + "dynamic": true, + "properties": {} + }, "suite": { "type": "keyword" }, -- 2.23.0

On Wed, Nov 18, 2020 at 03:53:42PM +0800, Zhang Yuhang wrote:
[why] By default, fields can be added dynamically to a document, or to ^^^^^ ^^^^^^^^^^^
dynamically added
inner objects within a document, just by indexing a document containing the new field.
However, there are many fields that we do not need, and "Limit of total fields [1000] in index [jobs] has been exceeded" exception will be reported when the number of fields exceeds 1000.
[how] Disable default dynamic mapping. ^...
maybe can add purposes here with 'to reduce unnecessary fields'. Thanks, Kaiyi
Signed-off-by: Zhang Yuhang <zhangyuhang25@huawei.com> --- sbin/es-jobs-mapping.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/sbin/es-jobs-mapping.sh b/sbin/es-jobs-mapping.sh index 9d420f7..076bdd3 100755 --- a/sbin/es-jobs-mapping.sh +++ b/sbin/es-jobs-mapping.sh @@ -38,6 +38,7 @@ else curl -H 'Content-Type: Application/json' -XPUT 'http://localhost:9200/jobs' -d '{ "mappings": { "_doc": { + "dynamic": false, "dynamic_templates": [ { "pp": { @@ -61,6 +62,10 @@ else } ], "properties": { + "pp": { + "dynamic": true, + "properties": {} + }, "suite": { "type": "keyword" }, -- 2.23.0

On Wed, Nov 18, 2020 at 04:39:51PM +0800, Lu Kaiyi wrote:
On Wed, Nov 18, 2020 at 03:53:42PM +0800, Zhang Yuhang wrote:
[why] By default, fields can be added dynamically to a document, or to ^^^^^ ^^^^^^^^^^^
dynamically added
Adverbs can be placed after verbs.
inner objects within a document, just by indexing a document containing the new field.
However, there are many fields that we do not need, and "Limit of total fields [1000] in index [jobs] has been exceeded" exception will be reported when the number of fields exceeds 1000.
[how] Disable default dynamic mapping. ^...
maybe can add purposes here with 'to reduce unnecessary fields'.
Thanks, Kaiyi
Thanks, but the reason has been introduced in "[why]". And I think "[how]" means "how to do". Thanks, Zhang Yuhang
Signed-off-by: Zhang Yuhang <zhangyuhang25@huawei.com> --- sbin/es-jobs-mapping.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/sbin/es-jobs-mapping.sh b/sbin/es-jobs-mapping.sh index 9d420f7..076bdd3 100755 --- a/sbin/es-jobs-mapping.sh +++ b/sbin/es-jobs-mapping.sh @@ -38,6 +38,7 @@ else curl -H 'Content-Type: Application/json' -XPUT 'http://localhost:9200/jobs' -d '{ "mappings": { "_doc": { + "dynamic": false, "dynamic_templates": [ { "pp": { @@ -61,6 +62,10 @@ else } ], "properties": { + "pp": { + "dynamic": true, + "properties": {} + }, "suite": { "type": "keyword" }, -- 2.23.0
participants (2)
-
Lu Kaiyi
-
Zhang Yuhang