Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Non boosted
- {
- "query": {
- "constant_score": {
- "filter": {
- "bool": {
- "must": [
- {
- "term": {
- "state": 1
- }
- },
- {
- "term": {
- "cat_state": 1
- }
- },
- {
- "bool": {
- "should": [
- {
- "range": {
- "end_date": {
- "gte": "2019-06-26 17:38:59"
- }
- }
- },
- {
- "term": {
- "end_date": "0"
- }
- },
- {
- "bool": {
- "must_not": [
- {
- "exists": {
- "field": "end_date"
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "bool": {
- "should": [
- {
- "range": {
- "publish_end_date": {
- "gte": "2019-06-26 17:38:59"
- }
- }
- },
- {
- "term": {
- "publish_end_date": "0"
- }
- },
- {
- "bool": {
- "must_not": [
- {
- "exists": {
- "field": "publish_end_date"
- }
- }
- ]
- }
- }
- ]
- }
- }
- ],
- "should": [
- {
- "match": {
- "title": {
- "query": "dna",
- "operator": "and",
- "boost": 1.7
- }
- }
- },
- {
- "match": {
- "description": {
- "query": "dna",
- "operator": "and",
- "boost": 0.7
- }
- }
- }
- ],
- "must_not": [],
- "filter": []
- }
- }
- }
- }
- }
- //Boosted
- {
- "query": {
- "boosting": {
- "positive": {
- "bool": {
- "must": [
- {
- "term": {
- "state": 1
- }
- },
- {
- "term": {
- "cat_state": 1
- }
- },
- {
- "bool": {
- "should": [
- {
- "range": {
- "end_date": {
- "gte": "2019-06-26+17:42:52"
- }
- }
- },
- {
- "term": {
- "end_date": "0"
- }
- },
- {
- "bool": {
- "must_not": [
- {
- "exists": {
- "field": "end_date"
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "bool": {
- "should": [
- {
- "range": {
- "publish_end_date": {
- "gte": "2019-06-26+17:42:52"
- }
- }
- },
- {
- "term": {
- "publish_end_date": "0"
- }
- },
- {
- "bool": {
- "must_not": [
- {
- "exists": {
- "field": "publish_end_date"
- }
- }
- ]
- }
- }
- ]
- }
- }
- ],
- "should": [
- {
- "match": {
- "title": {
- "query": "dna",
- "operator": "and",
- "boost": 1.7
- }
- }
- },
- {
- "match": {
- "description": {
- "query": "dna",
- "operator": "and",
- "boost": 0.7
- }
- }
- }
- ],
- "must_not": [],
- "filter": []
- }
- },
- "negative": {
- "terms": {
- "_index": [
- "index_a",
- "index_c",
- "index_d",
- "index_e",
- "index_f"
- ]
- }
- },
- "negative_boost": 0.5
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment