Let's say I have an index with 2 fields:
lastName:
type: 'string'
emailAddresses:
type: 'object'
properties:
address:
type: 'string'
I want to return any record that either the lastName or any emailAddresses.address contain a given query_string.
For instance, for a query_string "est"..
This user would match:
{
"lastName": "Best",
"emailAddresses": [
{
"address": "none@none.com"
}
]
}
This user would match:
{
"lastName": "Mark",
"emailAddresses": [
{
"address": "none@test.com"
}
]
}
And this user would NOT match:
{
"lastName": "Mark",
"emailAddresses": [
{
"address": "none@none.com"
}
]
}
I have this working with a filtered query and or/regexp filters:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"or": [
{
"regexp": {
"lastName": ".*est.*"
}
},
{
"regexp": {
"emailAddresses.address": ".*est.*"
}
}
]
}
}
}
}
I'd really prefer to NOT have to use regexp, but I haven't figured out a way to do it otherwise. Is there a way in version 1.6?