CopyPastor

Detecting plagiarism made easy.

Score: 0.8103339076042175; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-09-22
by arakibi

Original Post

Original - Posted on 2016-10-10
by Or Weinberger



            
Present in both answers; Present only in the new answer; Present only in the old answer;

In case somebody would need this in the future, this is how I solved it:
``` { "query": { "bool": { "filter": [ { "bool": { "should": [ { "range": { "valid_until": { "gte": "now" } } }, { "bool": { "must_not": { "exists": { "field": "valid_until" } } } } ] } } ], "must_not": [], "should": [], "must": [] } } } ```
Your query is indeed malformed, the filter should be under a `bool` element which should be under the `query` element. Also, when using `or`/`and` you should create separate objects for each filter element (range/term etc..) for example:
{ "size": 50, "query": { "bool": { "must": { "match_all": {} }, "filter": { "or": [ { "term": { "fromPlace": "liverpool" } }, { "range": { "query": { "gte": "01/01/2012", "lte": "2013", "format": "dd/MM/yyyy||yyyy" } } } ] } } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;