What is best mapping for Cassandra TimeUUID field to Solr. I am using DSE 3.2.4 version
5 Answers
If you have any plans of upgrading, DSE4.5
has solr that allows both uuid and timeuuid to be set as 'uuid'. http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/srch/srchSolrType.html

- 37,948
- 19
- 131
- 194

- 31
- 2
Starting in version 3.2.6 of DSE, the CQL type timeuuid
maps to the Solr type UUIDField
.

- 565
- 3
- 10
-
I'm sure Solr will allow you to sort over a field of type `UUIDField`, but I can't see how it would sort temporally, since `UUIDField` is a type 4 UUID. If you want to do that, perhaps using a CQL `timestamp`, which maps to a Solr `DateField`, would be worth a try. – Caleb Rackliffe Jun 05 '15 at 22:13
-
Yes, but there is no uniqueness for timestamp values. – sedovav Jun 08 '15 at 11:04
-
I don't think Solr has a temporal type that is guaranteed to be unique. You may end up having to use a field just for sorting, if I'm reading the situation correctly. – Caleb Rackliffe Jun 08 '15 at 18:47
TimeUUID is a UUID that contains the time embedded in it. In Solr, there is no proper mapping for this type of data.
What I can suggest you
- Keep the TimeUUID in a field (say "string" type).
- And keep it's corresponding time to another field (of "date" type) in the same document.
This way, you can have a mapping between the TimeUUID and the time extracted from it.

- 1,434
- 12
- 20
-
Unfortunately, solr complains about a type mismatch between cassandra and solr when uploading the schema. Changing timeuuid to uuid on cassandra side and setting the solr field type to uuid works, but then the timeuuid feature is lost on cassandra's side :/ – Arman Mar 22 '14 at 09:09
There is no mapping for a TimeUUID. You can see the full mapping list here:
http://www.datastax.com/documentation/datastax_enterprise/3.2/datastax_enterprise/srch/srchConf.html#srchConf__srchSolrType

- 3,991
- 25
- 31
Just I want to know how you going to use this timeUUID in your solr search. TimeUUID is a series of large numbers.
Pls try the below approach:
For example: UUID: 118ffe80-466b-11e1-b5a5-5732cf729524 for the Time (Tuesday, January 24, 2012 9:09:06 AM GMT). It is easy to search by Jan-24,2012 instead of UUID.
In Solr, dataconfig.xml , you can write javascript to covert the time uuid to actual date and create index for that field.
example: Get time details from the below code
< dataConfig>
< script> < ![CDATA[
function f1(row) {
var uuid= row.get('timeUUID');
//Java Script to convert UUID to Date
row.put('timeUUID', uuid);
return row;
}
]] > < /script>
< document>
< entity name="e" transformer="script:f1" query="select * from X">
....
< /entity>
< /document>
Tips: You can create any extra fields using script. example: Year, Day, Month and etc.

- 196
- 11