弹性搜索必须至少在渗滤器查询中有一个

时间:2015-08-26 08:43:37

标签: elasticsearch elasticsearch-percolate

我试图根据以下几个因素向用户提出建议:

•建议必须只是来自同一所大学的学生 •建议必须至少匹配一个其他字段

我以为我有它,但问题是这个查询将返回来自同一所学校的所有学生,不管其他一切:

PUT /user/.percolator/4
{
  "query": {
    "bool": {
    "must": [
        { "match": { "college":{
            "query" : "Oakland University",
            "type" : "phrase"
        }}}
    ],
      "should": [

            { "match": { "hashtag": "#chipotle" }},
            { "match": { "hashtag": "#running"}},
            { "match": { "college_course": "ART-160" }}

      ]
    }
  }
}

POST /user/stuff/_percolate/
{  
  "doc":{  

    "college":"Oakland University",
    "college_course": "WRT BIO MTH-400"


  }
}

0 个答案:

没有答案