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
Search Facets: Histogram Facet - allow to create buckets with one field name, and aggregate valued on another field #219
Comments
implemented. |
What if all I want is the bucketed facets, no aggregation? |
can you give an example? |
So for example I want to know the the count of documents fitting into date buckets. Eg. I have a document with a created_at field which is a date. I want to know how many have been found each day of the month for the last month, something akin to http://wiki.apache.org/solr/SimpleFacetParameters#Date_Faceting_Parameters |
The check out #228, it gives you the ability to work within the script on a date object, which has simple constructs to get, for example, the day of month as the key. In order to perform it in the last month, you will need to either execute a filter on the facet, or on the query, depends on the scope of your query (if its already filters by "last month filter). |
One more thing, you can also define |
Plugin Retry
close elastic#219 (cherry picked from commit 5a1f1af241d6db36fb39524ac00d86742771c91d)
Resolves #221 Because ESQL needs to know the context of the current command to correctly parse its structure, command names need to be lexed as individual tokens if they occur in a position where a command name is expected (at the beginning of the query or after a pipe). But if the command name occurs in a different position, it acts as a normal identifier and should be lexed accordingly. The easiest way to achieve this is to introduce two separate lexer modes. The default mode is used in the command context and the EXPRESSION mode is used when parsing the content of a command (expressions). Another lexer mode in the context of the from command could also be used to address #219. Unfortunately, lexer modes are only supported if the parser and lexer are split into two separate grammars (not within a combined grammar). I tried to keep the diff caused by this split as minimal as possible but ANTLR does not make this very easy. Alternatively, one could also allow the command tokens as an alternative for UNQUOTED_IDENTIFIER and then turn it into its string representation in the visitor. This approach is more brittle though as forgetting to add a command as a possible identifier can break existing queries. Additionally, it does not allow alternative lexer modes for commands that accepts arguments other than normal expressions.
You can created buckets based on one field values (for example, timestamp), and total/count another field from the same doc.
Here is an example:
The text was updated successfully, but these errors were encountered: