gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 23:13:58 29 4
gpt4 key购买 nike

我最初有以下作为 flex 搜索查询的排序字段

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"}
]

关于elasticsearch - 意外发生错误 'Fielddata is disabled on text fields by default',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57669588/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com