Elasticsearch dynamic mapping versus Solr dynamic field

In Solr, I can define a dynamic field and bind it to a specific data type. In the following example, all fields in the indexed document ending in "dt" will be indexed as long. <dynamicField name="*_dt" stored="true" indexed="true" type="long" multiValued="true"/>

In ElasticSearch, knowing the name of the field, I can use the "properties" under the node in the "mappings" to index the fields for a particular type. "properties": { "msh_datetimeofmessage_hl7_dt": { "type": "date", "format": "YYYYMMddHHmmss" },

I tried the following and tried unsuccessfully to use a template. "properties": { "*_dt": { "type": "date", "format": "YYYYMMddHHmmss" },

Does ElasticSearch support the same functionality as Solr, as described above?

Thanks in advance.

+5
source share
1 answer

I think you can look for dynamic template functionality. If I am mistaken, your comparison will look something like this (mostly borrowed from the linked page).

 PUT /my_index { "mappings": { "my_type": { "dynamic_templates": [ { "my_date_template": { "match": "*_dt", "mapping": { "type": "date", "format": "YYYYMMDDHHmmss" } }} ] }}} 
+3
source

Source: https://habr.com/ru/post/1215833/


All Articles