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

[Bug]: ManyToOneRelation can maximum return 10 hits #170

Open
AndrewKMoses opened this issue Sep 9, 2022 · 3 comments
Open

[Bug]: ManyToOneRelation can maximum return 10 hits #170

AndrewKMoses opened this issue Sep 9, 2022 · 3 comments

Comments

@AndrewKMoses
Copy link

Expected behavior

Filtering using ManyToOneRelation returns all matches

Actual behavior

Filtering using ManyToOneRelation returns maximum 10 hits.

Steps to reproduce

I have a template setup as below where Options is a ManyToOneRelation.

image

On the line below, there is no size parameter included, giving you the default size, which is 10.

https://github.com/pimcore/advanced-object-search/blob/4.x/src/Filter/FieldDefinitionAdapter/ManyToOneRelation.php#L121

I tried setting this to something very large (10000) giving me the error message below:

`{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: maxClauseCount is set to 1024",
"index_uuid": "8P3R0UYRTHOrMiL0YPZlAg",
"index": "advanced_object_search_article"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "advanced_object_search_article",
"node": "1lK30pC5RayahBM7mN_duA",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: maxClauseCount is set to 1024",
"index_uuid": "8P3R0UYRTHOrMiL0YPZlAg",
"index": "advanced_object_search_article",
"caused_by": {
"type": "too_many_clauses",
"reason": "maxClauseCount is set to 1024"
}
}
}
]
},
"status": 400
}

Server threw exception - could not perform action. Please reload the admin interface and try again.`

There is a setting (indices.query.bool.max_clause_count) to change the maximum number of clauses, but the docs do not recommend that.

https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-settings.html

@kingjia90
Copy link
Contributor

kingjia90 commented Sep 13, 2022

@AndrewKMoses Thank you for the report but i cannot reproduce the exact same problems, i can change the maximum $size to 10000 without problems, over that throws errors.
image
But it's different from your case, it mentions Clause

For me it works, even on demo using the Manufacturer many-to-one field

image
image

Can you provide further details?

@AndrewKMoses
Copy link
Author

Well, my main point in this issue is that the size argument is missing, giving you a default of 10 hits. That should be fixed somehow?

What is indices.query.bool.max_clause_count configured to in your case? That might explain the different results in error.

In your case it seems like it's the same issue as in #85?

@kingjia90
Copy link
Contributor

kingjia90 commented Sep 13, 2022

Well, my main point in this issue is that the size argument is missing, giving you a default of 10 hits. That should be fixed somehow?

yes, that's a good point and needs to be improved. The question now is what number should replace 10 .
One idea that comes to my mind is be to allowing the user to type its own numbers, by adding 2 extra optional fields eg. $from/$size on each filter.

What is indices.query.bool.max_clause_count configured to in your case? That might explain the different results in error.

I haven't changed any configuration, so it should be also the same default value at 1024.
NB: Since v8, they changed default value to 4096.

In your case it seems like it's the same issue as in #85?

Doesn't look the same to me, i've just put a $size value that exceeded index.max_result_window.
The actual response is not that large to crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants