0

I have created UDT in Cassandra

CREATE type starter.random_data_demo(  
   destination_wise_count map<text,text>
);

then used this udt in my table

CREATE TABLE demo(
   field_data FROZEN<random_data_demo> PRIMARY KEY 
   );

when i hit query for elasticsearch mapping receives an error

query:-

curl -XPUT -H 'Content-Type:application/json' "http://localhost:9200/demo" -d '{
    "settings": { "keyspace":"starter" },
    "mappings": {
        "demo" : {
            "discover" : ".*"
        }
    }
}'

error:-

"type":"mapper_parsing_exception","reason":"Failed to execute query:null : Field \"destination_wise_count\" with type map<text, text> does not match type frozen<\"testing.demo_field_data_destination_wise_count\">"}]

2 Answers2

0

Can you provide the final JSON document(also checks if using same JSON you are able to create mapping), which you are using to create the index mapping, mapper parsing exception comes when we don't supply the mapping which Elasticsearch(ES) can parse.

You should also provide the entire stacktrace to understand the issue more, it seems you are using the static mapping and trying to insert the document which contains the field which is either not present in ES mapping or not format of the field is not proper ie trying to insert text in numeric field etc.

Amit
  • 30,756
  • 6
  • 57
  • 88
  • when i use text instead of map in user defined type then same query works properly – Kunal bhardwaj Aug 13 '20 at 11:16
  • { "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Failed to execute query:null : Field \"destination_wise_count\" with type map does not match type frozen<\"starter.demo_field_data_destination_wise_count\">" } ] }, "status": 400 } – Kunal bhardwaj Aug 13 '20 at 11:19
0

Found:

CQL map is currently only supported as a top-level field of a document, we cannot use it in a nested field.