二进制字段类型
编辑二进制字段类型编辑
binary
类型接受一个二进制值,以 Base64 编码的字符串形式。默认情况下,该字段不会被存储,也不可搜索。
response = client.indices.create( index: 'my-index-000001', body: { mappings: { properties: { name: { type: 'text' }, blob: { type: 'binary' } } } } ) puts response response = client.index( index: 'my-index-000001', id: 1, body: { name: 'Some binary blob', blob: 'U29tZSBiaW5hcnkgYmxvYg==' } ) puts response
PUT my-index-000001 { "mappings": { "properties": { "name": { "type": "text" }, "blob": { "type": "binary" } } } } PUT my-index-000001/_doc/1 { "name": "Some binary blob", "blob": "U29tZSBiaW5hcnkgYmxvYg==" }