Hi everybody,
I have the following situation:
My index mapping contains:
:string_root_field_1, type: 'string', :index => 'analyzed'
:string_root_field_2, type: 'string', :index => 'analyzed'
indexes :array_nested_field, type: 'nested' do
:string_nested_field_1, type: 'string', index: 'analyzed'
:string_nested_field_2, type: 'string', index: 'analyzed'
end
My search clause contains:
query: {
bool: {
should: [
{
query_string: {
query: 'nnnn rrrr',
field: %w(string_root_field_1, string_root_field_2)
analyzer: 'brazilian',
default_operator: 'AND'
}
},
{
nested: {
path: 'array_nested_field',
query: {
query_string: {
query: 'nnnn rrrr',
field: %w(string_nested_field_1, string_nested_field_2)
analyzer: 'brazilian',
default_operator: 'AND'
}
}
}
}
],
minimum_should_match: 1,
}
}
Considering that the default_operator must be AND, and there is an indexed document that contains:
string_root_field_1: rrrr
string_nested_field_1: nnnn
if my query term is
nnnn rrrr,
elastic isn't returing any result.
How can define my query so that I can query over nested fields and root fields simultaneously?
Is that possible?
Thanks in advance,
Guilherme