0
有沒有什麼方法可以在使用過濾器查詢時轉換字段的數據類型。 ,我不得不的場景是我有一個文件與現場Elasticsearch在查詢時轉換字段的數據類型
customData: {
"contactCustomFieldMapId":xxxx,
"contactId":xxxxx,
"customFieldId":45788,
"value":"1899",
"fieldInputTypeId":0
},
{
"contactCustomFieldMapId":xxxx,
"contactId":xxxxx,
"customFieldId":45732,
"value":"Meet me at noon",
"fieldInputTypeId":0
},
{
"contactCustomFieldMapId":xxxx,
"contactId":xxxxx,
"customFieldId":23233,
"value":"233589",
"fieldInputTypeId":0
}
在上述字段中的值屬性可以是任何數據類型(字符串,DATATIME,或數字),在那裏,因爲我需要使用來提取數據的範圍過濾器(大於,小於)。這個範圍過濾器應具有長期濾波器結合使用我布爾過濾器做了一個查詢作爲
"filter": {
"and": {
"filters": [
{
"bool": {
"must": [
{
"and": {
"filters": [
{
"term": {
"customData.customFieldId": 45788
}
},
{
"range": {
"customData.value": {
"gt": "1000"
}
}
}
]
}
}
]
}
}
]
}
}
不幸的是,查詢與customData.customFieldId獲取的所有記錄爲45788(按類似工作存在的過濾器)。
有沒有什麼辦法可以將術語過濾器和範圍過濾器結合起來。
沒有變化,帶來了所有的記錄。這個問題與'customData.value'的歸檔類型相關嗎? – 2015-04-03 08:29:02
我不知道對不起。也許你可以在創建索引之前嘗試對數據進行映射。 映射允許您爲每個字段選擇一種類型(並且格式類似大寫/小寫/分析數據等) – AlainIb 2015-04-03 11:54:52