Phrase Match with Filters

I have an index called 'companies' that contains two types, 'company' and
'file'. I'm trying to perform exact match queries on the 'file' types of a
specific company. I am querying with phrases like "iso 9001" and would
like to get exact match results across all indexed content for a 'file'
type. This includes multiple strings, objects and a file. If my mappings
are correct, I think the _all field should be fine to search against in
this case.

Below is my best guess at the correct ElasticSearch api query, but, having
tried, many different variations, continue to fail. Please help.

curl -XPOST 'http://domain.com:9200/companies/_search?pretty=true' -d '
{
"query": {
"match": {
"message": {
"query": "iso 9001",
"type": "phrase"
}
}
},
"filter": {
"term": { "_type": "file" },
"term": { "_parent": "85164" }
}
}
'

Here is my mapping code for 'file' types ( i am using elastica, a php api
client, to generate these ):

$Files_type = $this->Companies_index->getType( 'file' );
$Files_mapping = new Elastica_Type_Mapping();
$Files_mapping->setType( $Files_type );
$Files_mapping->setProperties(
array(
'content_type' => array( 'type' => 'string', 'include_in_all' => FALSE ),
'url' => array( 'type' => 'string', 'include_in_all' => FALSE ),
'tier' => array( 'type' => 'integer' ),
'is_webpage' => array( 'type' => 'boolean', 'null_value' => FALSE,
'include_in_all' => FALSE ),
'is_product' => array( 'type' => 'boolean', 'null_value' => FALSE,
'include_in_all' => FALSE ),
'is_datasheet' => array( 'type' => 'boolean', 'null_value' => FALSE,
'include_in_all' => FALSE ),
'title' => array( 'type' => 'string', 'boost' => 2.0 ),
'description' => array( 'type' => 'string', 'boost' => 2.0 ),
'keywords' => array( 'type' => 'string', 'boost' => 2.0 ),
'h1_tags' => array( 'type' => 'string', 'index_name' => 'h1_tag', 'boost'
=> 3.0 ), // array lists are pushed in here
'h2_tags' => array( 'type' => 'string', 'index_name' => 'h2_tag', 'boost'
=> 2.5 ), // array lists are pushed in here
'h3_tags' => array( 'type' => 'string', 'index_name' => 'h3_tag', 'boost'
=> 2.0 ), // array lists are pushed in here
'anchor_texts' => array(
'type' => 'object',
'properties' => array(
'anchor_text' => array(
'type' => 'object',
'properties' => array(
'text' => array( 'type' => 'string', 'boost' => 10.0 ),
'frequency' => array( 'type' => 'integer', 'index' => 'no',
'include_in_all' => FALSE ),
)
)
)
),
'url_words' => array( 'type' => 'string', 'boost' => 2.0 ),
'min_price' => array( 'type' => 'float', 'index' => 'no', 'include_in_all'
=> FALSE ),
'max_price' => array( 'type' => 'float', 'index' => 'no', 'include_in_all'
=> FALSE ),
'file' => array( 'type' => 'attachment' ),
'images' => array(
'type' => 'object',
'index' => 'no',
'include_in_all' => FALSE,
'properties' => array(
'image' => array(
'type' => 'object',
'properties' => array(
'id' => array( 'type' => 'integer' ),
'tier' => array( 'type' => 'integer' ),
'extension' => array( 'type' => 'string' ),
'entropy' => array( 'type' => 'float' ),
)
)
)
),
'last_processed' => array( 'type' => 'date', 'format' =>
'date_time_no_millis', 'include_in_all' => FALSE, 'null_value' => '' ),
)
); // end setProperties()
$Files_mapping->setParam( '_parent', array( 'type' => 'company' ) );
$Files_mapping->setSource( array( 'excludes' => array( 'file' ) ) ); //
prevents the file from being stored in the source
$Files_mapping->send();

--

here is the solution:

{
"query": {
"match_phrase": {
"_all": "adhesive tapes"
}
},
"filter": {
"term": {
"_type": "file",
"_parent": "43"
}
}
}

--