Skip to content

Instantly share code, notes, and snippets.

Created September 16, 2014 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/cdbfbb940fa8da81019f to your computer and use it in GitHub Desktop.
Save anonymous/cdbfbb940fa8da81019f to your computer and use it in GitHub Desktop.
{
"constant_score": {
"filter": {
"bool": {
"must": {
"terms": {
"groups": [
"a",
"b",
"c"
]
}
},
"should": [
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "foo"
}
},
"filter": {
"missing": {
"field": "attr1"
}
}
}
}
},
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "foo"
}
},
"filter": {
"terms": {
"attr1": [
"v1",
"v2"
]
}
}
}
}
}
]
}
}
}
}
{
"constant_score": {
"filter": {
"bool": {
"must": {
"terms": {
"groups": [
"a",
"b",
"c"
]
}
},
"should": {
"query": {
"filtered": {
"query": {
"query_string": {
"query": "foo"
}
},
"filter": {
"bool": {
"should": [
{
"missing": {
"field": "attr1"
}
},
{
"terms": {
"attr1": [
"v1",
"v2"
]
}
}
]
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment