Created
June 18, 2014 17:21
-
-
Save dyangrev/6d27c8921f4b63b8ea0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "from": "0", | |
| "size": "25", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "filtered": { | |
| "query": { | |
| "custom_score": { | |
| "script": "_score >= 1 ? 100000000000 : 0", | |
| "query": { | |
| "filtered": { | |
| "query": { | |
| "has_child": { | |
| "query": { | |
| "constant_score": { | |
| "filter": { | |
| "and": [{ | |
| "term": { | |
| "propertyId": 2 | |
| } | |
| }, { | |
| "term": { | |
| "_type": "guest_stay" | |
| } | |
| }, { | |
| "term": { | |
| "confirmationStatus": "VALID" | |
| } | |
| }] | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "sum", | |
| "boost": 1 | |
| } | |
| }, | |
| "filter": { | |
| "and": [{ | |
| "has_child": { | |
| "query": { | |
| "filtered": { | |
| "query": { | |
| "match_all": {} | |
| }, | |
| "filter": { | |
| "and": [{ | |
| "numeric_range": { | |
| "roomRate": { | |
| "gte": 0, | |
| "lte": 6862 | |
| } | |
| } | |
| }, { | |
| "term": { | |
| "confirmationStatus": "VALID" | |
| } | |
| }] | |
| } | |
| } | |
| }, | |
| "type": "guest_stay" | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "filter": { | |
| "match_all": {} | |
| } | |
| } | |
| }], | |
| "should": [{ | |
| "filtered": { | |
| "query": { | |
| "custom_score": { | |
| "script": "10000000000", | |
| "query": { | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "-1 * doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkinDate": { | |
| "lte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "range": { | |
| "checkoutDate": { | |
| "gte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "term": { | |
| "confirmationStatus": "VALID" | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| } | |
| } | |
| }, | |
| "filter": { | |
| "match_all": {} | |
| } | |
| } | |
| }, { | |
| "filtered": { | |
| "query": { | |
| "custom_score": { | |
| "script": "20000000000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "-1 * doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkinDate": { | |
| "gt": "2014-05-14" | |
| } | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| }], | |
| "must_not": [{ | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "-1 * doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkinDate": { | |
| "lte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "range": { | |
| "checkoutDate": { | |
| "gte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "term": { | |
| "confirmationStatus": "VALID" | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "filter": { | |
| "match_all": {} | |
| } | |
| } | |
| }, { | |
| "filtered": { | |
| "query": { | |
| "custom_score": { | |
| "script": "30000000000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkoutDate": { | |
| "lt": "2014-05-14" | |
| } | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| }], | |
| "must_not": [{ | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "-1 * doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkinDate": { | |
| "lte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "range": { | |
| "checkoutDate": { | |
| "gte": "2014-05-14" | |
| } | |
| } | |
| }, { | |
| "term": { | |
| "confirmationStatus": "VALID" | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| }, { | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "-1 * doc[\"guest_stay.checkinDate\"].value \/ 1000", | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "range": { | |
| "checkinDate": { | |
| "gt": "2014-05-14" | |
| } | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "type": "guest_stay", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| }] | |
| } | |
| } | |
| } | |
| }, | |
| "filter": { | |
| "match_all": {} | |
| } | |
| } | |
| }, { | |
| "filtered": { | |
| "query": { | |
| "custom_score": { | |
| "script": "_score", | |
| "query": { | |
| "has_child": { | |
| "query": { | |
| "custom_score": { | |
| "script": "doc[\"guest_property.state\"].value", | |
| "query": { | |
| "match_all": {} | |
| } | |
| } | |
| }, | |
| "type": "guest_property", | |
| "score_type": "max", | |
| "boost": 1 | |
| } | |
| } | |
| } | |
| }, | |
| "filter": { | |
| "match_all": {} | |
| } | |
| } | |
| }], | |
| "minimum_number_should_match": "2", | |
| "disable_coord": true | |
| } | |
| }, | |
| "min_score": 100000000000, | |
| "sort": { | |
| "_score": { | |
| "order": "asc" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment