-
-
Notifications
You must be signed in to change notification settings - Fork 46
Comprehensive ElasticSearch Query and Aggregation Enhancement #76
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
base: main
Are you sure you want to change the base?
Conversation
- Implement MatchAllQuery that matches all documents - Support optional boost parameter - Add comprehensive test coverage with 6 test cases - Follow existing code patterns and conventions
- Implement IdsQuery for querying documents by their IDs - Support single and multiple document IDs - Handle string, numeric, and mixed ID types - Add comprehensive test coverage with 7 test cases - Follow existing code patterns and conventions
- Implement FuzzyQuery for fuzzy text matching with edit distance - Support fuzziness parameter (auto, numeric values) - Support max_expansions, prefix_length, transpositions parameters - Support boost parameter for query scoring - Add comprehensive test coverage with 10 test cases - Follow existing code patterns and conventions
- Implement AvgAggregation for calculating average values - Support missing value handling using WithMissing trait - Support meta information for aggregations - Add comprehensive test coverage with 8 test cases - Fix missing value condition to handle null values properly - Follow existing code patterns and conventions
- Add ExistsQueryTest with 5 test cases covering field existence checks - Add PrefixQueryTest with 7 test cases covering prefix matching - Test various scenarios including nested fields, special characters, and edge cases - Improve test coverage for existing query implementations - Follow existing test patterns and conventions
- Change missing parameter from string '0' to integer 0 in AvgAggregationTest - Ensure consistency in type handling for missing values in tests
- Implement RegexpQuery for regular expression pattern matching - Support flags parameter for regex modifiers (CASE_INSENSITIVE, DOTALL, etc.) - Support max_determinized_states parameter for performance control - Support boost parameter for query scoring - Add comprehensive test coverage with 11 test cases - Test various regex patterns including escaped characters and complex patterns - Follow existing code patterns and conventions
- Implement HistogramAggregation for numeric value distribution analysis - Support interval parameter for bucket size configuration - Support min_doc_count parameter for filtering empty buckets - Support extended_bounds parameter for ensuring bucket range - Support offset parameter for adjusting bucket boundaries - Support sub-aggregations using WithAggregations trait - Support missing value handling using WithMissing trait - Add comprehensive test coverage with 13 test cases - Test various scenarios including negative values and sub-aggregations - Follow existing code patterns and conventions
- Implement MatchNoneQuery that matches no documents - Simple query with no parameters, returns empty object - Add comprehensive test coverage with 6 test cases - Test instance creation, consistency, and object structure - Useful for filters and boolean query combinations - Follow existing code patterns and conventions
- Add RangeQueryTest with 17 test cases covering range operations - Test all range operators: gte, lte, gt, lt with various data types - Test with integers, floats, strings, and null values - Test multiple conditions, overwriting conditions, and nested fields - Test edge cases including zero values, negative values, and null handling - Improve test coverage for existing RangeQuery implementation - Follow existing test patterns and conventions
- Add TermQueryTest with 18 test cases covering exact term matching - Test with different data types: strings, integers, booleans - Test edge cases including zero values, empty strings, negative numbers - Test special characters, Unicode characters, and nested fields - Test consistency and independence of multiple instances - Improve test coverage for existing TermQuery implementation - Follow existing test patterns and conventions
- Add WildcardQueryTest with 20 test cases covering wildcard pattern matching - Test asterisk (*) and question mark (?) wildcards in various combinations - Test edge cases including empty strings, only wildcards, and no wildcards - Test complex patterns, nested fields, and special characters - Test Unicode characters and spaces in patterns - Test consistency and independence of multiple instances - Improve test coverage for existing WildcardQuery implementation - Follow existing test patterns and conventions
- Add documentation for FuzzyQuery, IdsQuery, MatchAllQuery, MatchNoneQuery, RegexpQuery, AvgAggregation, and HistogramAggregation - Include usage examples and relevant links to Elasticsearch documentation for each new query and aggregation type - Enhance clarity and completeness of the README for better developer guidance
…' into new-feature-20250802
- Add rewrite parameter support for FuzzyQuery and RegexpQuery for performance optimization - Add hard_bounds parameter to HistogramAggregation for bucket range limiting - Modernize PercentilesAggregation with advanced algorithm support: - Remove deprecated method() function and backward compatibility - Add keyed() method for output format control - Add tdigest() method with compression and execution_hint support - Add hdr() method for HDR Histogram algorithm - Update comprehensive test coverage for all new functionality - All implementations verified against official Elasticsearch specifications 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update FuzzyQuery example to include rewrite parameter - Update RegexpQuery example to include rewrite parameter - Update HistogramAggregation example to include hardBounds method - Update PercentilesAggregation example with modern syntax: - Replace deprecated method() with tdigest() - Add keyed() method example for output format control - Show execution_hint parameter usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
@AlexVanderbist Can this pr be merged? |
Sorry is this AI generated? |
Yes, but not entirely. I was involved in part of the implementation and have tested the code myself. |
Right.. please check your changes carefully, when using AI, you are still solely responsible for the workings of the code. The links in the README for example all redirect, please point them to the correct pages. |
@freekmurze should spatie repositories have some kind of mention of AI usage? |
I checked the links, and they all point to the correct documents. |
For me this is not necessary. Like you already mentioned, a human that generates the code via AI should review it as (or even more) thoroughly as if reviewing a code that was written by a human. And all the old rules apply. The fact that code is easily generated via AI changes nothing. We should only merge code if it's beneficial for most packages users (or for the maintainers of a package). |
@freekmurze @bram-pkg Can this PR be merged? I think the queries I submit are ones that are frequently needed. |
Hi, like I asked before - can you make the links point to the documentation pages so they don't redirect immediately? |
Hi, thank you for pointing out the issue—I hadn't noticed it. I've fixed it. I've also discovered that other links in the document have redirect problems. |
hey @summerKK, if this PR is ready to be reviewed and merged, please change it from draft to ready for review. @bram-pkg regarding the use of AI in packages: I think it's inevitable. However, we're talking internally about having some more official guidelines on code responsibility and how we think AI should be used in (open-source) projects. |
Interesting, thanks! I think it's important that developers don't shift the thinking process onto the reviewer rather than themselves. |
🎯 Overview
This PR significantly enhances the ElasticSearch Query Builder with 5 new query types, advanced aggregation features, and comprehensive missing value handling.
✨ New Features
🔍 New Query Types (5 Added)
📊 Enhanced Aggregations
📈 Impact Summary
🧪 Test Coverage
🔧 Usage Examples
FuzzyQuery
PercentilesAggregation
IdsQuery
🔒 Quality Assurance
🎯 Ready for Production
This enhancement positions the ElasticSearch Query Builder as a more powerful, flexible, and production-ready tool. All features are battle-tested with comprehensive documentation.
Ready for review and merge! 🚀