CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2020-12-03
by Opster ES Ninja Nishant

Original Post

Original - Posted on 2018-03-09
by Val



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

The reason you are facing this with terms query is because the `should` clause is outside `filter` clause and contributing to score calculation. This is the reason these terms are subject to max_clause_count. If score is not required for that part then you can rephrase you query as below:
{ "query": { "bool": { "filter": [ { "nested": { "query": { "range": { "dateField": { "from": "2019-12-03T21:34:30.653Z", "to": "2020-12-02T21:34:30.653Z", "include_lower": true, "include_upper": true, "boost": 1 } } }, "path": "observed_feeds", "ignore_unmapped": false, "score_mode": "none", "boost": 1 } }, { "should": [ { "bool": { "filter": [ { "terms": { "ipAddressField": [ "123.123.123.123", "124.124.124.124", ... like 20,000 of these ], "boost": 1 } } ], "adjust_pure_negative": true, "boost": 1 } } ] } ], "adjust_pure_negative": true, "boost": 1 } } }
The correct way of doing it is to use `bool/must_not`: var request = { index: 'my-index', type: 'property', body: { from : page * perPage, size : perPage, query: { bool: { must_not: [ { "term" : { "listing.rentForSale" : "R" } }, { "term" : { "listing.statusCode" : "Rented" } }, { "term" : { "zip" : "00000" } } ], filter : [ { geo_distance : { distance : range + 'mi', 'position' : point } } ] } }, sort: [{ _geo_distance: { "position": point, "order": "asc", "unit": "mi", "distance_type": "plane" } }] } };


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