我有一个doctype,其中包含以下映射:
import {Component, OnInit, ViewEncapsulation, Input} from '@angular/core';
import './baBootStrapTags.loader.ts';
@Component({
selector: 'ba-tags-input',
template: require('./baBootStrapTags.html'),
encapsulation: ViewEncapsulation.None,
})
export class BaBootStrapTags implements OnInit {
cities: Bloodhound; // <----- ERROR HERE
@Input() config:Object = {
itemValue: 'value',
itemText: 'text',
typeaheadjs: {
name: 'cities',
displayKey: 'text',
source: this.cities.ttAdapter()
}
};
}
我正在尝试将某些字段从GET my_index/my_doctype/_mapping
{
"my_index": {
"mappings": {
"my_doctype": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "string"
},
"prod_id": {
"type": "string"
},
"host": {
"type": "string"
},
"message": {
"type": "string"
},
"path": {
"type": "string"
},
"img_path": {
"type": "string"
},
"tags": {
"type": "string"
}
}
}
}
}
}
更改为analyzed
,因此我会运行此请求:
non_analyzed
但是我收到以下错误:
PUT my_index/_mapping/my_doctype
{
"properties": {
"prod_id": {
"type": "string",
"index": "not_analyzed"
},
"img_path": {
"type": "string",
"index": "not_analyzed"
}
}
}
如何将字段“prod_id”和“img_path”更改为{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Mapper for [img_path] conflicts with existing mapping in other types:\n[mapper [img_path] has different [index] values, mapper [img_path] has different [doc_values] values, cannot change from disabled to enabled, mapper [img_path] has different [analyzer], mapper [img_path] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
}
],
"type": "illegal_argument_exception",
"reason": "Mapper for [img_path] conflicts with existing mapping in other types:\n[mapper [img_path] has different [index] values, mapper [img_path] has different [doc_values] values, cannot change from disabled to enabled, mapper [img_path] has different [analyzer], mapper [img_path] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
},
"status": 400
}
答案 0 :(得分:1)
您无法更改现有字段的映射。你有两个解决方案:
not_analyzed
子字段并重新索引数据第二个解决方案是这样的:
PUT my_index/_mapping/my_doctype
{
"properties": {
"prod_id": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"img_path": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
然后,您可以在重新编制数据索引后使用prod_id.raw
和img_path.raw
。