I am new to elasticsearch and I am trying to create a multi_field index with stringand fields array of strings. stringEverything works fine with fields , but when I try to get some results when they are inside the array, it returns empty.
My details:
{
"string_field_one": "one",
"string_field_two": "two",
"array_of_strings_field": [
"2010", "2011", "2012", "2013"
]
}
Display:
{
"string_field_one" : {
"type" : "string",
"analyzer": "snowball",
"copy_to": "group"
},
"string_field_two" : {
"type" : "string",
"analyzer": "snowball",
"copy_to": "group"
},
"array_of_strings_field" : {
"type" : "string",
"analyzer": "keyword",
"copy_to": "group"
}
"group" : {
"type": "multi_field"
}
}
Search:
"body": {
"query": {
"multi_match": {
"query": "one two 2010",
type: "cross_fields",
operator: "and",
fields: [
"string_field_one",
"string_field_two",
"array_of_strings_field",
"group"
]
}
}
}
Expecting:
- Search by
one, twoor 2010should return a result - Search
one twoshould return a result - Search
one two 2010should return a result - Search
one two 2008should not return a result
What am I missing?
source
share