Skip to content

Instantly share code, notes, and snippets.

@stevenc81
Created June 24, 2015 08:18
Show Gist options
  • Save stevenc81/365a7e6e275efae0c4bb to your computer and use it in GitHub Desktop.
Save stevenc81/365a7e6e275efae0c4bb to your computer and use it in GitHub Desktop.
user_id: '54eee748ec1e417d7e42e8fb', value: { profile: { service_type: 'page', profile_id: [Object], service: 'google' }, partner_source: '', via: 'api', placement: null, shared_now: false, num_profiles: 4, top: false, source: 'api', version: null, update_id: { '$oid': '558a6751f73c1407578b456c' }, client_id: { '$oid': '5022676c169f37db0e00001c' }, partner_placement: '', scheduled_at: { '$date': 1435159200000 } }, metric: 'event.updates', date: 1435133777000 }
@coxchen
Copy link

coxchen commented Jun 24, 2015

create index with default mapping

PUT /event_data

{
    "mappings": {
        "_default_": {
            "_timestamp": {
              "enabled":  true,
              "path": "date"
            },
            "user_id" : {
              "type" : "string",
              "analyzer" : "keyword"
            },
            "metric" : {
              "type" : "string",
              "analyzer" : "keyword"
            },
            "date" : {
              "type":"date"
            }
        }
    }
}

@stevenc81
Copy link
Author

Thanks so much @coxchen!

I made some modifications to this

{
   "mappings":{
      "_default_":{
         "_timestamp":{
            "enabled":true,
            "store":true
         },
         "_ttl":{
            "enabled":true,
            "default":"28d"
         },
         "properties":{
            "user_id":{
               "type":"string",
               "analyzer":"keyword"
            },
            "metric":{
               "type":"string",
               "analyzer":"keyword"
            },
            "date":{
               "type":"date"
            }
         }
      }
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment