CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2019-06-01
by niranjan harpale

Original Post

Original - Posted on 2018-03-14
by Eirini Graonidou



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

This is how you can nest multiple bool queries in one outer bool query this using Kibana,
GET my_inedx/my_type/_search { "query" : { "bool": { //bool indicates we are using boolean operator "must" : [ //must is for **AND** { "match" : { "description" : "some text" } }, { "match" :{ "type" : "some Type" } }, { "bool" : { //here its a nested boolean query "should" : [ //should is for **OR** { "match" : { //ur query } }, { "match" : {} } ] } } ] } } }


This is how you can nest a query in ES There are more types in "bool" like - 1. Filter 2. must_not
You need an extra `bool filter` between the `must` and `must_not` terms.
You should also think about your *myField* field. If it is defined as text or as keyword. Tested with elasticsearch 5.6.1 the following query works:
{ "query": { "bool": { "must": [{ "query_string": { "query": "this is a text content" } }], "filter": { "bool": { "should" : [{ "bool" : { "must_not": { "exists": { "field": "myField" } } } }, { "bool" : { "must": { "terms": { "myField.keyword": ["my field exists and has a value"] } } } }] } } } } }

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