2013-03-12 86 views
1

我的彈性搜索DSL存在問題,因爲在使用方面導航時,當我應用我的方面過濾器時,下一組結果不包含任何其他方面,即使我已經詢問他們。elasticsearch方面或過濾器

當我最初的搜索,我得到的結果,我想回去:

{ 
"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過濾器 - 因爲用戶可以選擇多個價格範圍進行過濾。

我做錯了什麼?

我希望新的層面返回改變價格顯然會改變其他方面的面數...

+0

我看到完全一樣的東西。當我的查詢塊包含「過濾」部分時,我不會在結果中返回任何方面 – svrist 2013-12-05 10:57:21

回答

0

添加原詞過濾的或過濾器裏面,或者添加其他布爾過濾包你的整個過濾器在一個布爾表達式中。我不認爲你可以通過逗號分隔它們來添加這兩個過濾器。

+0

嗯,查詢起作用。我得到了我期待的結果 - 但返回的JSON沒有facet對象(ALL)。 – Tom 2013-03-12 21:00:36

+0

我會做更多的調查 – Tom 2013-03-12 21:01:01