Elasticsearch Define Dynamic Mapping


(sreeram) #1

Hi,

I'm using Elasticsearch 2.3.4 & Elasticsearch.Net (Low-level client) SDK for indexing JSON documents which are dynamic in nature.

I want to create mapping for my JSON structure before indexing documents in order to avoid field type getting detected (numeric_detection & date_detection = True) wrongly while inserting the first document.

How to PUT below mapping (JSON) through Elasticsearch.Net Or NEST SDK API?!
PUT my_index
{
"mappings": {
"user": {
"_all": { "enabled": false },
"properties": {
"title": { "type": "string" },
"name": { "type": "string" },
"age": { "type": "integer" }
}
},
"blogpost": {
"properties": {
"title": { "type": "string" },
"body": { "type": "string" },
"user_id": {
"type": "string",
"index": "not_analyzed"
},
"created": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
}

Regards,
Sreeram


(sreeram) #3

please provide some clarifications.


(Christoph) #4

This question looks like How to define mapping in runtime, so I'll close it in favour of the other post.


(Christoph) #5