意外发生错误'Fielddata is disabled on text fields by default'



我最初在弹性搜索查询时有以下内容作为排序字段

sort : {"Name" : "asc"}

一切正常,直到我将其更改为以下版本

sort : [
{"Name" : "asc"},
{"_id" : "asc"}
]

我开始收到以下错误

Fielddata is disabled on text fields by default. Set fielddata=true on [Name] 

我认为这可能与使用_id有关,因此将其更改为文档上的另一个唯一字段,例如subId。即使使用subId,我也会遇到相同的错误。 我无法理解为什么我只在更改时收到此错误,而不是其他错误(旧排序字段(

这是现有映射

{
"vm05": {
"mappings": {
"1-4534": {
"dynamic": "strict",
"_all": {
"store": true
},
"properties": {
"10293965_REF_TO_BILL_TO_PRO": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"10293966_MASTER_ALT": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"14653178_NETWORK": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4725_PRT_SYS": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4726_PRO_NAME": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4727_REF_TO_PRO": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"4728_RPR_RATE": {
"type": "double"
},
"4729_RPR_OCCURENCE": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4731_CHGE_BAS": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4732_PERIODICITY": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"4908_RPR_COMMENT": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"5586986_RATE_ZONE": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"8626875_REF_TO_DEPENDENT_PROD": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"8626876_REF_TO_PROD_HOLD": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"8626877_REF_TO_PROD_HOLD_TYP": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"9358147_K2ND_REF_TO_PRO": {
"properties": {
"ParentId": {
"type": "keyword",
"include_in_all": true
},
"ParentLabel": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
}
}
},
"AttributeMetadata": {
"include_in_all": false,
"properties": {
"AttributeFieldId": {
"type": "keyword",
"include_in_all": false
},
"AttributeId": {
"type": "keyword",
"include_in_all": false
},
"AttributeLabel": {
"type": "keyword",
"include_in_all": false
}
}
},
"CategoryId": {
"type": "keyword",
"include_in_all": false
},
"CategoryRACL": {
"type": "keyword",
"include_in_all": false
},
"DefaultLookupCode": {
"type": "keyword",
"include_in_all": true
},
"EndDate": {
"type": "date",
"include_in_all": false
},
"IsDeleted": {
"type": "boolean"
},
"IsLatest": {
"type": "boolean"
},
"IsPublished": {
"type": "boolean"
},
"Name": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "mdm_lowercase_analyzer",
"fielddata": true
},
"raw": {
"type": "keyword"
}
}
},
"StartDate": {
"type": "date",
"include_in_all": false
},
"SubjectId": {
"type": "keyword",
"include_in_all": false
},
"SubjectRACL": {
"type": "keyword",
"include_in_all": false
}
}
}
}
}
}

如果将sort部分更改为以下内容,它将正常工作而不会出错:

sort : [
{"Name.raw" : "asc"},
{"_id" : "asc"}
]

相关内容

最新更新