Oh I just tried and it seems possible to integrate sql handler and streaming
expressions, so it should be possible to aggregate sql results using stream
decorators in many ways:
jdbc(
connection="jdbc:solr://SOLR_ZK_CONNECTION_STRING?collection=COLLECTION_NAME",
sql="select NAME, ADDRESS, EMAIL, AGE from PEOPLE where AGE > 25 order by
AGE, NAME DESC",
sort="AGE asc, NAME desc"
)
Sent from Mail for Windows
From: ufuk yılmaz
Sent: Monday, August 21, 2023 4:45 PM
To: [email protected]
Subject: RE: sql datetime field aggregation
I didn’t use it too much but I’d guess syntax support for sql would be limited
to simple things. I’d love to learn if anybody has knowledge on the sql handler.
If your field is indexed using datetime field type or long number since epoch,
then range faceting could be a way to group based on month or year.
Solr SQL uses streaming expressions under the hood, streaming expressions offer
a world of different abilities when querying, but you’d need to learn it’s
syntax.
If you want to levarage your existing SQL knowledge on top of Solr, Apache
Spark could be an option. It can load data from Solr efficiently and run SQL to
analyze it, plus it supports nearly anything SQL can offer in terms of
aggregation.
-ufuk yilmaz
Sent from Mail for Windows
From: Kojo
Sent: Monday, August 21, 2023 4:06 PM
To: [email protected]
Subject: sql datetime field aggregation
Is there a way in Solr SQL to truncate data and aggregate it? for
example, by month or year in a datetime field? Or is the Solr approach
to create separate fields to enable these aggregations?
Thanks in advance,
Koji