CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2023-04-16
by Mathew

Original Post

Original - Posted on 2019-05-03
by Joe Zack



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

Since you filter by jobIds, then you don't have to filter in script,
{ "query": { "function_score": { "query": { "match_all": {} }, "functions": [ { "filter": { "terms": { "_id": [ 6, 22, 98, 16 ] } }, "script_score": { "script": { "source": "9999 - Integer.parseInt(doc['_id'].value)" } } }, { "filter": { "match_all": {} }, "script_score": { "script": { "source": "return 0" } } } ], "score_mode": "sum" } } }
If I understand your question correctly, I believe you are looking for something like this.
It looks a bit wacky but it roughly translates to: "Find me (Vanaraj, 27 years old, in India) or (Ranjit, who is 26 in US)"
# Setup a sample index with data PUT /stackoverflowtest/_doc/1 { "Name" : "Vanaraj", "Age" : "27", "country" : "India" } PUT /stackoverflowtest/_doc/2 { "Name" : "Ranjit", "Age" : "26", "country" : "US" } PUT /stackoverflowtest/_doc/3 { "Name" : "Joe", "Age" : "38", "country" : "US" } # Query that returns Vanaraj / 27 / India or Ranjit / 26 / US POST /stackoverflowtest/_search { "query": { "bool": { "should": [ { "bool": { "must": [ { "match": { "Name": "Vanaraj" } }, { "match": { "Age": "27" } }, { "match": { "country": "India" } } ] } }, { "bool": { "must": [ { "match": { "Name": "Ranjit" } }, { "match": { "Age": "26" } }, { "match": { "country": "US" } } ] } } ] } } }

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