Hi there
I'm trying to make a search query to 2 slightly different indexes simultaneously. One of them contains field of nested type, another does not. So I add 'ignore_unmapped' option to nested query to avoid exception but this does not help. I'm using elasticsearch version 5.0.
Here is part of the query
'bool' => array(
'filter' => array(
array( 'term' => array( '_index' => 'index_with_nested_field' ) ),
),
'should' => array(
array(
'nested' => array(
'ignore_unmapped' => true,
'path' => 'NESTED_FIELD',
'query' => array(
'function_score' => array(
'functions' => array(
array(
'filter' => array(
'bool' => array(
'must' => array(
array( 'term' => array( 'NESTED_FIELD.sub1' => 0 ) ),
array( 'range' => array( 'NESTED_FIELD.sub2' => array( 'gt' => 3 ) ) )
)
),
),
'weight' => -10,
)
and the query URI looks like this
/index_with_nested_field,index_without_nested_field/_search...
and part of the error looks like this
'index' => string 'index_without_nested_field' (length=18)
'caused_by' =>
array (size=2)
'type' => string 'illegal_state_exception' (length=23)
'reason' => string '[nested] failed to find nested object under path [NESTED_FIELD]'
If I remove functions part of the query it works fine, so seems it ignores ignore_unmapped option.
Please advise.