Just to give you a sample.

Partial doc JSON:

{
  "id": "524107608429699072",
  "createdAt": "Oct 20, 2014 9:59:25 AM",
  "source": {
    "created_at": "Mon Oct 20 07:59:25 +0000 2014",
    "source": "<a href=\"http://ElwynRoad.com\"; rel=\"nofollow\">Elwyn 
Road</a>",
    "retweet_count": 0,
    "retweeted": false,
    "filter_level": "medium",
    "id_str": "524107608429699072",
...

As you can see "createdAt" conforms nicely to the following mapping:

{
    "settings" : {
        "index" : {
            "number_of_shards" : 1,
            "number_of_replicas" : 1
        }
    },
    "mappings" : {
        "envelope_v1" : {
            "_all" : { "enabled" : true },
            "_id" : { "index" : "not_analyzed", "store" : false, "path" : 
"id" },
            "_timestamp" : { "enabled" : true, "path" : "createdAt" },
            "_ttl" : { "enabled" : true, "default" : "30d" },
            "properties" : {
                "id" : { "type" : "string", "store" : false, "index" : "no" 
},
                "createdAt" : { "type" : "date", "format" : "MMM d',' YYYY 
KK:mm:ss aa", "store" : true, "index" : "no" },
                "ref" : { "type" : "string", "store" : false, "index" : 
"no" },
                "sourceType" : { "type" : "string", "store" : false, 
"index" : "no" },
                "search" : { "type" : "string", "store" : false, "index" : 
"no" },
                "source.created_at" : { "type" : "date", "format" : "EEE 
MMM d HH:mm:ss Z YYYY", "store" : false, "index" : "no" },
                "source.timestamp_ms" : { "type" : "date", "store" : false, 
"index" : "no" },
                "source.user.created_at" : { "type" : "date", "format" : 
"EEE MMM d HH:mm:ss Z YYYY", "store" : false, "index" : "no" },
                "source.analysis.nlp" : { "type" : "object", "store" : 
false, "index" : "no" }
            }
        }
    }
}

Still ES throws:

ElasticsearchParseException[failed to parse doc to extract 
routing/timestamp/id]; nested: TimestampParsingException[failed to parse 
timestamp [Oct 20, 2014 9:59:25 AM]]; 


Sigh...



On Monday, October 20, 2014 9:06:44 AM UTC+2, Peter Litsegård wrote:
>
> Hi!
>
> I've been struggling with two date formats. I'll give you a sample and the 
> corresponding date format I've used:
>
> 1. "Oct 20, 2014 8:42:41 AM" : MMM d YYYY hh:mm:ss aa
> 2. "Mon Oct 20 06:42:41 +0000 2014" : EEE MMM d HH:mm:ss Z YYYY
>
> I've used the following mapping:
>
> {
>     "settings" : {
>         "index" : {
>             "number_of_shards" : 1,
>             "number_of_replicas" : 1
>         }
>     },
>     "mappings" : {
>         "envelope_v1" : {
>             "_all" : { "enabled" : true },
>             "_id" : { "index" : "not_analyzed", "store" : false, "path" : 
> "id" },
>             "_timestamp" : { "enabled" : true, "path" : "createdAt" },
>             "_ttl" : { "enabled" : true, "default" : "30d" },
>             "properties" : {
>                 "id" : { "type" : "string", "store" : false, "index" : 
> "no" },
>                 "createdAt" : { "type" : "date", "format" : "MMM d YYYY 
> hh:mm:ss aa", "store" : false, "index" : "no" },
>                 "ref" : { "type" : "string", "store" : false, "index" : 
> "no" },
>                 "sourceType" : { "type" : "string", "store" : false, 
> "index" : "no" },
>                 "search" : { "type" : "string", "store" : false, "index" : 
> "no" },
>                 "source.created_at" : { "type" : "date", "format" : "EEE 
> MMM d HH:mm:ss Z YYYY", "store" : false, "index" : "no" },
>                 "source.timestamp_ms" : { "type" : "date", "store" : 
> false, "index" : "no" },
>                 "source.user.created_at" : { "type" : "date", "format" : 
> "EEE MMM d HH:mm:ss Z YYYY", "store" : false, "index" : "no" },
>                 "source.analysis.nlp" : { "type" : "object", "store" : 
> false, "index" : "no" }
>             }
>         }
>     }
> }
>
> While adding data I get the following exception:
>
> java.lang.IllegalArgumentException: Invalid format: "Mon Oct 20 06:30:52 
> +0000 2014"
>     at 
> org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:754)
>
> What am I doing wrong here?
>
> Cheers
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8afad408-5c12-4831-80d5-83ea37294547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to