1

Elasticsearch DSL に問題があります。ファセット ナビゲーションを使用しているときに、ファセット フィルターを適用すると、要求したにもかかわらず、結果の次のセットにそれ以上のファセットが含まれません。

最初の検索を行うと、必要な結果が返されます。

{
"sort": {
    "_score": {},
    "salesQuantity": {
        "order": "asc"
    }
},
"query": {
    "filtered": {
        "query": {
            "match": {
                "categoryTree": "D01"
            }
        },
        "filter": {
            "term": {
                "publicwebEnabled": true,
                "parentID": 0
            }
        }
    }
},
"facets": {
    "delivery_locations": {
        "terms": {
            "field": "delivery_locations",
            "all_terms": true
        }
    },
    "categories": {
        "terms": {
            "field": "categoryTree",
            "all_terms": true
        }
    },
    "collectable": {
        "terms": {
            "field": "collectable",
            "all_terms": true
        }
    }
},
"from": 0,
"size": 12}

次に、そのようなフィルターを適用すると、返される結果にはファセットが含まれません。

{
"sort": {
    "_score": {},
    "salesQuantity": {
        "order": "asc"
    }
},
"query": {
    "filtered": {
        "query": {
            "match": {
                "categoryTree": "D01"
            }
        },
        "filter": {
            "term": {
                "publicwebEnabled": true,
                "parentID": 0
            },
            "or": [
                {
                    "range": {
                        "Retail_Price": {
                            "to": "49.99",
                            "from": "0"
                        }
                    }
                }
            ]
        }
    }
},
"facets": {
    "delivery_locations": {
        "terms": {
            "field": "delivery_locations",
            "all_terms": true
        }
    },
    "categories": {
        "terms": {
            "field": "categoryTree",
            "all_terms": true
        }
    },
    "collectable": {
        "terms": {
            "field": "collectable",
            "all_terms": true
        }
    }
},
"from": 0,
"size": 12}

: 上記の OR フィルターを追加しています。これは、ユーザーがフィルター処理する複数の価格帯を選択できるためです。

私は何か間違ったことをしていますか?

価格を変更すると明らかに他のファセットのファセット数が変更されるため、新しいファセットが返されることを望みます...

4

1 に答える 1

0

or-filter 内に元の term-filter を追加するか、別のブール フィルターを追加して、フィルター全体をブール式内にラップします。そのようにコンマで区切るだけで2つのフィルターを追加できるとは思いません。

于 2013-03-12T06:41:59.590 に答える