Skip to content

Instantly share code, notes, and snippets.

@ogavrisevs
Created December 14, 2013 13:47
Show Gist options
  • Save ogavrisevs/7959300 to your computer and use it in GitHub Desktop.
Save ogavrisevs/7959300 to your computer and use it in GitHub Desktop.
EsTimeStampMapping.json
[vagrant@vagrant-centos64 elasticsearch]$ curl -X PUT http://localhost:9200/twitter_33/ -d '
> {
>
> "mappings": {
> "tweet": {
>
> "_timestamp" : {
> "enabled" : "yes",
> "path" : "post_date"
> },
> "properties": {
> "message": {
> "type": "string"
> }
> }
> }
> }
> }
> '
{"ok":true,"acknowledged":true}[vagrant@vagrant-centos64 elasticsearch]$
[vagrant@vagrant-centos64 elasticsearch]$ curl -X PUT http://localhost:9200/twitter_33/tweet/1 -d '
> {
> "tweet" : {
> "message" : "You know, for Search",
> "post_date" : "2009-11-15T14:12:12"
> }
> }
> '
{"error":"ElasticSearchParseException[failed to parse doc to extract routing/timestamp]; nested: TimestampParsingException[failed to parse timestamp [null]]; ","status":400}[vagrant@vagrant-centos64 elasticsearch]$
curl -X PUT http://localhost:9200/twitter_33/ -d '
{
"mappings": {
"tweet": {
"_timestamp" : {
"enabled" : "yes",
"path" : "post_date"
},
"properties": {
"message": {
"type": "string"
}
}
}
}
}
'
curl -X PUT http://localhost:9200/twitter_33/tweet/1 -d '
{
"tweet" : {
"message" : "You know, for Search",
"post_date" : "2009-11-15T14:12:12"
}
}
'
[vagrant@vagrant-centos64 elasticsearch]$ curl 'http://localhost:9200/_cluster/nodes?pretty=true'
{
"ok" : true,
"cluster_name" : "lvTwetterCluster",
"nodes" : {
"QCLL6vKjRhq1uLPhxBZkuQ" : {
"name" : "Nocturne",
"transport_address" : "inet[/192.168.56.102:9300]",
"version" : "0.90.7",
"http_address" : "inet[/192.168.56.102:9200]"
},
"pkpiRxOeS8Gcjpsupn20Vg" : {
"name" : "Druid",
"transport_address" : "inet[/192.168.56.101:9300]",
"version" : "0.90.7",
"http_address" : "inet[/192.168.56.101:9200]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment