-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add Query by Example feature #2418
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
Comments
Interesting topic, I never used or needed that so I never had a look at it, but it would be a nice addition. I just had a look how Spring Data Mongodb uses this, but they have the luck that the mongo db itself supports an example query. For Spring Data Elasticsearch we'd need to build a query from the example, and I think that using a As for the regex match: You are right, this is not yet supported. This could be added either in this issue or as a separate issue to be done before that. Elasticsearch has a regexp term query that should be used for that. Fluent query - just had a first look at it myself - is not directly related or a prerequisite to the query by example topic, rather something that can be used for that as well. Adding this would probably be a separate issue. One thing I noticed about the If you have code which you'd like to add, you're welcome to provide this as a PR, so I can have a look at that to see how it fits into the existing codebase. |
Added Query by Example repositories fragments Added Criteria.regexp
Fixed Criteria.regexp Minor fixes in QueryByExample fragments and mapper Improved test coverage
Thanks again, I rarely get such such nice written contributions. |
Hi spring-data-elasticsearch team.
I'd like to contribute to this project implementing Query by Example feature from Spring Data.
I found this feature extremely useful in the past. The use case is to avoid custom repositories method explosion for queries based on nullable fields filter models.
My initial approach is to create the following implementations:
public class QueryByExampleElasticsearchExecutor<T> implements QueryByExampleExecutor<T>
public class ReactiveQueryByExampleElasticsearchExecutor<T> implements ReactiveQueryByExampleExecutor<T>
and use them as fragments in repository factories.
I have an initial working version based on CriteriaQuery, for simplicity, but missing of the following features:
The text was updated successfully, but these errors were encountered: