(ElasticSearhc) bool 쿼리와 bool필터
bool쿼리
* must
(query1 AND query2 AND query3)가 반드시 일치해야함
* should
(query1 OR query2 OR query3)가 반드시 일치해야함
* must_not
반드시 일치하지 않아야함
GET get-together/_search
{
"query" : {
"bool" : {
"must" : [
{
"term" : {
"attendees" :"david"
}
}
],
"should" : [
{
"term" : {
"attendees" : "client"
}
},
{
"term" : {
"attendees" : "andy"
}
}
],
"must_not" : [
{
"range" : {
"date" : {
"lt" : "2013-06-30T00:00"
}
}
}
],
"minimum_should_match" : 1
}
}
}
* must
(query1 AND query2 AND query3)가 반드시 일치해야함
* should
(query1 OR query2 OR query3)가 반드시 일치해야함
* must_not
반드시 일치하지 않아야함
GET get-together/_search
{
"query" : {
"bool" : {
"must" : [
{
"term" : {
"attendees" :"david"
}
}
],
"should" : [
{
"term" : {
"attendees" : "client"
}
},
{
"term" : {
"attendees" : "andy"
}
}
],
"must_not" : [
{
"range" : {
"date" : {
"lt" : "2013-06-30T00:00"
}
}
}
],
"minimum_should_match" : 1
}
}
}
댓글
댓글 쓰기