EDIT: This setup is using Elasticsearch 6.1.3
Can this be done? I am trying to set up a front-end search that looks through several fields, so the multi-match and or query-string.
I would like to search in both the "number" field and the "update.statement" fields(as well as some others, but the combination of the nested and non-nested is where I am having trouble) . I have cut the large object down in size to just show the important fields as it is quite large.
module.exports = {
mappings: {
object: {
properties: {
company: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
number: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
<SNIP>
update: {
type: 'nested',
properties: {
level: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
level_index: {
type: "integer"
},
snow_severity: {
type: "integer"
},
sites: {
type: 'nested',
properties: {
sys_id: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
name: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
}
}
},
impact: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
statement: {
type: "text",
fields: {
raw: {
type: "keyword",
ignore_above: 256
}
}
},
submission_timestamp: {
type: "date"
},
<SNIP>
}
}
}
}
}
}
This is the current search I am using which works great for just the "number field" (written in node.js)
const multiSearch = (index, fields, query, from, size, sort) => config.elasticClient.search({
index,
type: 'object',
body: {
query: {
query_string: {
query,
fields
}
}
},
from,
size,
sort
})