Skip to content

Instantly share code, notes, and snippets.

Created June 5, 2013 18:19
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/5715994 to your computer and use it in GitHub Desktop.
Save anonymous/5715994 to your computer and use it in GitHub Desktop.
{
"from": 0,
"size": 20,
"query": {
"filtered": {
"query": {
"custom_filters_score": {
"query": {
"bool": {
"minimum_number_should_match": 1,
"should": [
{
"text": {
"field1_text": {
"type": "phrase",
"query": "search text",
"analyzer": "custom1",
"slop": 2,
"boost": 50.0
}
}
},
{
"text": {
"obj1.field2_text": {
"type": "phrase",
"query": "search text",
"analyzer": "custom1",
"slop": 3,
"boost": 10.0
}
}
},
{
"text": {
"field1_text": {
"query": "search text",
"analyzer": "custom1",
"boost": 20.0,
"operator": "and"
}
}
},
{
"text": {
"obj1.field2_text": {
"query": "search text",
"analyzer": "custom1",
"boost": 6.0,
"operator": "and"
}
}
},
{
"text": {
"field1_text": {
"query": "search text",
"analyzer": "custom1",
"boost": 10.0,
"operator": "or"
}
}
},
{
"text": {
"obj1.field2_text": {
"query": "search text",
"analyzer": "custom1",
"operator": "or"
}
}
}
]
}
},
"filters": [
{
"filter": {
"numeric_range": {
"field2_numeric": {
"from": 0,
"include_lower": false
}
}
},
"boost": 10.0
},
{
"filter": {
"numeric_range": {
"field3_numeric": {
"from": 0,
"include_lower": false
}
}
},
"boost": 5.0
}
]
}
},
"filter": {
"and": {
"filters": [
{
"term": {
"field4_text": "en"
}
},
{
"not": {
"filter": {
"term": {
"field5_int": "5"
}
}
}
},
{
"not": {
"filter": {
"term": {
"field5_int": "4"
}
}
}
},
{
"terms": {
"field6_text": [
"b5bc7d55-43e1-4b26-918e-ed1b8d373b3a",
"6dc802ec-178d-4199-9641-36da6964b1f8",
"03e795a9-6c23-4c0c-8e4e-c20d88f284ba",
"e91c471d-8d4a-4976-90f3-009e08fcf92a",
"9975b471-4d10-4249-bcd1-b4b525c5babb"
]
}
},
{
"term": {
"field7_bool": "true"
}
},
{
"term": {
"field8_bool": "false"
}
}
]
}
}
}
},
"highlight": {
"pre_tags": [
"[tag1]"
],
"post_tags": [
"[/tag2]"
],
"order": "score",
"fields": {
"field1_text": {
"number_of_fragments": 0
},
"obj1.field2_text": {
"fragment_size": 500,
"number_of_fragments": 1
}
},
"require_field_match": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment