Elastic Search で奇妙な動作が発生します。フィルターの使用を開始する前に、次のクエリがありました。
FILTER を使用しないクエリ
{
"query": {
"bool": {
"must": [
{
"match": {
"_facility": {
"query": "error",
"operator": "AND"
}
}
},
{
"match": {
"_application": {
"query": "live",
"operator": "AND"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [
{
"created_at": {
"sort_mode": null,
"order": "desc",
"missing": null,
"ignore_unmapped": null
}
},
{
"_score": {
"sort_mode": null,
"order": null,
"missing": null,
"ignore_unmapped": null
}
}
]
}
次に、FILTERを追加する必要がありました
{
"query": {
"bool": {
"must": [
{
"match": {
"_facility": {
"query": "error",
"operator": "AND"
}
}
},
{
"match": {
"_application": {
"query": "live",
"operator": "AND"
}
}
}
],
"must_not": [],
"should": []
}
},
"filter": {
"and": {
"filters": [
{
"range": {
"created_at": {
"from": 1373320800,
"to": 1373493599,
"include_lower": true,
"include_upper": true
},
"_cache": true
}
}
]
},
"_cache": false
},
"from": 0,
"size": 10,
"sort": [
{
"created_at": {
"sort_mode": null,
"order": "desc",
"missing": null,
"ignore_unmapped": null
}
},
{
"_score": {
"sort_mode": null,
"order": null,
"missing": null,
"ignore_unmapped": null
}
}
]
}
次の問題があります。
1) 結果が created_at で正しくソートされず、シャッフルされたデータのように見える
2) サイズ - 10 以外のカスタム値は考慮されません (たとえば、20 [または 5] レコードを表示したいのですが、10 個あります)。
助けてくれてありがとう。おそらく、Elastic Search の概念に何かが欠けています。