Cannot return Elasticsearch results for Content Picker Field when multiple options are selected
Description I'm working on a search module and trying to build it around Elasticsearch. I'm having trouble getting accurate results when filtering based on the selected items in a content picker field when the field has multiple options selected. Specifically, only the first item in the field is being indexed properly.
Data These are the related values that I have stored in the content item:
{
"AllFieldsPart": {
"ContentPickerListMultiple": {
"ContentItemIds": [
"4sjtqvw77bhfs3qz6s000s0r47",
"4skvb8x1zq8522xjecjtnj62mx"
]
}
}
}
This is what the elastic search index looks like:
And this is the query that I have been using:
{
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"should": [
//{
// "match": {
// "AllFieldsPart.ContentPickerListMultiple": "4sjtqvw77bhfs3qz6s000s0r47"
// }
//},
{
"match": {
"AllFieldsPart.ContentPickerListMultiple": "4skvb8x1zq8522xjecjtnj62mx"
}
}
],
"minimum_should_match": 1
}
}
}
Outcome When the commented out section of the query is included, the content item appears in the search result. But without it, no results appear. I want the content item to appear if either value is selected in the filter. I don't believe that my query is the problem, but in how the data is stored in the index.
Hmm, both (all) IDs should be indexed here. I don't know, @Skrypt perhaps you have a hint?
It is probably the same issues as with multiple taxonomy terms.
I have noticed the same issue with multiple taxonomy terms.
Multiple taxonomy terms work fine with this format. ,{ "terms": { "Article.Category.Inherited": [{% for tax in taxonomy %}"{{tax}}"{% unless forloop.last %},{% endunless %}{% endfor %}] } }