Elasticsearch query from JSON formatted string? Elasticsearch query from JSON formatted string? elasticsearch elasticsearch

Elasticsearch query from JSON formatted string?


You should store your status object as an Elasticsearch object backed by an UDT (a Cassandra User Defined Type), and then, you will be able to search in with an elasticsearch nested query.

You can create your cassandra schema with a UDT for the status column and auto-discover the mapping, or specify the elasticsearch mapping to generate the CQL schema. The optional cql_udt_name allows to name the UDT name, as shown bellow :

XContentBuilder mapping = XContentFactory.jsonBuilder()                .startObject()                    .startObject("properties")                        .startObject("id").field("type", "keyword").field("cql_collection", "singleton").field("cql_primary_key_order", 0).field("cql_partition_key", true).endObject()                        .startObject("event_timestamp")                            .field("type", "date")                            .field("format", "strict_date_hour_minute_second||epoch_millis")                            .field("cql_collection", "singleton")                        .endObject()                        .startObject("event_info")                            .field("type", "nested")                            .field("cql_collection", "singleton")                            .field("cql_udt_name", "event_info_udt")                            .field("dynamic", "false")                            .startObject("properties")                               .startObject("event_timestamp")                                .field("type", "date")                                .field("format", "strict_date_hour_minute_second||epoch_millis")                                .field("cql_collection", "singleton")                            .endObject()                        .endObject()                    .endObject()                    .endObject()                .endObject();


I am not sure about my solution is ok for you.

Can you try with JSON processor


Ingest processor is not supported with elassandra, you should use the proposed mapping to index your UDT.Thanks.