Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot return Elasticsearch results for Content Picker Field when multiple options are selected #15990

Open
MEllis-Bethany opened this issue May 6, 2024 · 3 comments
Labels
Milestone

Comments

@MEllis-Bethany
Copy link

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:
image

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.

@Piedone
Copy link
Member

Piedone commented May 7, 2024

Hmm, both (all) IDs should be indexed here. I don't know, @Skrypt perhaps you have a hint?

@Skrypt
Copy link
Contributor

Skrypt commented May 8, 2024

It is probably the same issues as with multiple taxonomy terms.

@MEllis-Bethany
Copy link
Author

I have noticed the same issue with multiple taxonomy terms.

@sebastienros sebastienros added this to the 2.x milestone May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants