IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Bool Queries
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Bool Queries
editBool queries can be easily constructed using the client. For example, this query:
curl -XGET 'localhost:9200/my_index/my_type/_search' -d '{
"query" : {
"bool" : {
"must": {
"match" : {
"testField" : "abc"
},
"match" : {
"anotherTestField" : "xyz"
}
}
}
}
}'
Would be structured like this (Note the position of the square brackets):
$params['index'] = 'my_index';
$params['type'] = 'my_type';
$params['body']['query']['bool']['must'] = array(
array('match' => array('testField' => 'abc')),
array('match' => array('anotherTestField' => 'xyz')),
);
$results = $client->search($params);