_meta 字段
编辑_meta
字段
编辑映射类型可以关联自定义元数据。 这些元数据不会被 Elasticsearch 使用,但可用于存储特定于应用程序的元数据,例如文档所属的类。
resp = client.indices.create( index="my-index-000001", mappings={ "_meta": { "class": "MyApp::User", "version": { "min": "1.0", "max": "1.3" } } }, ) print(resp)
response = client.indices.create( index: 'my-index-000001', body: { mappings: { _meta: { class: 'MyApp::User', version: { min: '1.0', max: '1.3' } } } } ) puts response
const response = await client.indices.create({ index: "my-index-000001", mappings: { _meta: { class: "MyApp::User", version: { min: "1.0", max: "1.3", }, }, }, }); console.log(response);
PUT my-index-000001 { "mappings": { "_meta": { "class": "MyApp::User", "version": { "min": "1.0", "max": "1.3" } } } }
可以使用 GET mapping API 检索此 |
可以使用 update mapping API 在现有类型上更新 _meta
字段。
resp = client.indices.put_mapping( index="my-index-000001", meta={ "class": "MyApp2::User3", "version": { "min": "1.3", "max": "1.5" } }, ) print(resp)
response = client.indices.put_mapping( index: 'my-index-000001', body: { _meta: { class: 'MyApp2::User3', version: { min: '1.3', max: '1.5' } } } ) puts response
const response = await client.indices.putMapping({ index: "my-index-000001", _meta: { class: "MyApp2::User3", version: { min: "1.3", max: "1.5", }, }, }); console.log(response);
PUT my-index-000001/_mapping { "_meta": { "class": "MyApp2::User3", "version": { "min": "1.3", "max": "1.5" } } }