2016-03-30 20 views
0

Özet olmaya çalışıyorum. Bu arama, multi_match adresinde bulunan arama anahtar kelimelerini uygulamıyor. Eklediğim arama metni, Her zaman aynı sonucu elde ediyorum.Elasticsearch: multi_match filtrelerle etki yok

filtered/filter'u silersem, bana uygun bir arama yapar. Niye ya?

GET /catalog/products/_search 
{ 
    "from":0, 
    "size":150, 
    "query":{ 
     "filtered":{ 
     "query":{ 
      "multi_match":{ 
       "query":"text to search", 
       "fields":[ 
        "title^5", 
        "description" 
       ] 
      }, 
      "filter":{ 
       "and":[ 
        { 
        "term":{ 
         "category": 2 
        } 
        }, 
        { 
        "not":{ 
         "term":{ 
          "subCategory": 3 
         } 
        } 
        } 
       ] 
      } 
     } 
     } 
    } 
} 

cevap

2

böyle, sorguda aynı seviyede filtreyi koyun:

GET /catalog/products/_search 
{ 
    "from":0, 
    "size":150, 
    "query":{ 
     "filtered":{ 
     "query":{ 
      "multi_match":{ 
      "query":"text to search", 
      "fields":[ 
       "title^5", 
       "description" 
      ] 
      } 
     }, 
     "filter":{ 
      "and":[ 
       { 
       "term":{ 
        "category": 2 
       } 
       }, 
       { 
       "not":{ 
        "term":{ 
         "subCategory": 3 
        } 
       } 
       } 
      ] 
     } 
     } 
    } 
} 
+0

Great! Yardımınız olmadan sorunu bulmak için görüşünü kaybederim! – Ivan

İlgili konular