Set of UDT with uuid not working
Elassandra version: 6.8.4.13
Steps to reproduce:
CREATE TYPE role_key (
course_id uuid,
role_id uuid
)
CREATE TABLE "user"
(
name text,
roles set<frozen<role_key>>,
PRIMARY KEY (name)
);
curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/user' -d '{ "settings": { "keyspace": "alpha" }, "mappings": { "user": { "discover": ".*"} } }'
Returns:
{
"error":{
"root_cause":[
{
"type":"mapper_parsing_exception",
"reason":"Failed to execute query:null : Field \"course_id\" with type uuid does not match updated type text"
}
],
"type":"mapper_parsing_exception",
"reason":"Failed to execute query:null : Field \"course_id\" with type uuid does not match updated type text",
"caused_by":{
"type":"invalid_request_exception",
"reason":"Field \"course_id\" with type uuid does not match updated type text"
}
},
"status":400
}
I do not completely understand the problem (exept what causes it, but not why). I have read #185 and thought sets would work this way? I have searched on google and read the doc, but I am not able to find an answer. Help would be highly appreciated. Also if someone could explain what an "updated type" is it would be highly appreciated by me.
I've now tried several ways to get this to work.
{
"settings": {
"keyspace": "alpha"
},
"mappings": {
"user": {
"discover": "^((?!roles).*)",
"properties": {
"roles": {
"type": "nested",
"cql_struct": "set",
"properties": {
"course_id": {
"type": "text"
},
"role_id": {
"type": "text"
}
}
}
}
}
}
}
Type keyword, fails with:
java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class java.util.UUID
at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:855)
at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:822)
at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:807)
at org.elassandra.cluster.Serializer.toXContent(Serializer.java:399)
at org.elassandra.cluster.Serializer.toXContent(Serializer.java:363)
at org.elassandra.cluster.QueryManager.buildDocument(QueryManager.java:106)
at org.elassandra.cluster.QueryManager.source(QueryManager.java:224)
at org.elasticsearch.search.fetch.FetchPhase.processCqlResultSet(FetchPhase.java:514)
at org.elasticsearch.search.fetch.FetchPhase.loadStoredFields(FetchPhase.java:540)
at org.elasticsearch.search.fetch.FetchPhase.createSearchHit(FetchPhase.java:217)
at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:169)
at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:424)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:404)
at org.elasticsearch.search.SearchService.access$100(SearchService.java:127)
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:360)
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:356)
at org.elasticsearch.search.SearchService$4.doRun(SearchService.java:1114)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:751)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Type text does not, BUT: Using type text the result is of every query is empty. I have no explanation for this behavior. If no one is responing to this issue i will have to use the Text cql type for the udt and call it a day. But I am most certainly not happy with this solution.