Custom field mapping


(CB) #1

hi all,

Sorry for the basic question - I'll appreciate any help :slight_smile:

I configured the field mapping of my index using the following json struct:

{ "template" : "", "order" : 10, "mappings" : { "couchbaseCheckpoint" : {
"_source" : { "includes" : ["doc.
"] }, "dynamic_templates": [ {
"store_no_index": { "match": "", "mapping": { "store" : "no", "index" :
"no", "include_in_all" : false } } } ] }, "default" : { "_source" : {
"includes" : ["meta.
"] }, "properties" : { "meta" : { "type" : "object",
"include_in_all" : false } } } }}

A typical document that I'm inserting looks like this:

{
"meta": {
"id": "1234",
"rev": "1-0001e50821cebfb80000000000000000",
"expiration": 0,
"flags": 0
},
"doc": {
"date": 12123321312
}
}

Now for the question - How to customize the mapping definition described
above so that the field "date" will be parsed as date (epoc time format)
and not as the result of auto mapping (type long).

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/46830de7-a757-4cf1-9e4c-cba84121ddf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

Hello CB ,

You can declare it as normal time type and it should be able to identify
epoch format be default.

"The date type will also accept a long number representing UTC milliseconds
since the epoch, regardless of the format it can handle.
" from
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#date

Thanks
Vineeth

On Wed, Sep 3, 2014 at 1:53 PM, CB chen.bekor@gmail.com wrote:

hi all,

Sorry for the basic question - I'll appreciate any help :slight_smile:

I configured the field mapping of my index using the following json struct:

{ "template" : "", "order" : 10, "mappings" : { "couchbaseCheckpoint" : {
"_source" : { "includes" : ["doc.
"] }, "dynamic_templates": [ {
"store_no_index": { "match": "", "mapping": { "store" : "no", "index" :
"no", "include_in_all" : false } } } ] }, "default" : { "_source" : {
"includes" : ["meta.
"] }, "properties" : { "meta" : { "type" : "object",
"include_in_all" : false } } } }}

A typical document that I'm inserting looks like this:

{
"meta": {
"id": "1234",
"rev": "1-0001e50821cebfb80000000000000000",
"expiration": 0,
"flags": 0
},
"doc": {
"date": 12123321312
}
}

Now for the question - How to customize the mapping definition described
above so that the field "date" will be parsed as date (epoc time format)
and not as the result of auto mapping (type long).

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/46830de7-a757-4cf1-9e4c-cba84121ddf1%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/46830de7-a757-4cf1-9e4c-cba84121ddf1%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mHGnD-_HtyF0wipQRFcogPnCEfyj-rsb-ekUAVNrVDow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3