ES 2.0
I've been trying to apply mapping to an index ( empty index ) but it doesn't seem to persist.
I've added sync.json to /config/mappings/_default
it contains:
{
"sync" :{
"_timestamp" : {
"enabled" : true,
"path" : "time",
"ignore_missing" : true,
"store":true
},
"properties": {
"channel": {
"type": "string",
"store" : true
},
"id": {
"type": "integer"
},
"level": {
"type": "integer",
"store" : true
},
"message": {
"type": "string"
},
"source": {
"type": "string"
},
"time": {
"type": "date"
},
"userid": {
"type": "integer",
"store" : true
}
}
}
}
I then add an index from sense with:
PUT my_index
when I do GET my_index/sync/_mapping I get {}
Using the PHP API I add documents to my_index/sync
I can query them :
GET my_index/_search
{
"query": {
"match_all": {}
}
}
and get results like this:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "my_index",
"_type": "sync",
"_id": "AVC0jcBJFw6NV60SFjbM",
"_score": 1,
"_source": {
"id": "12435",
"channel": "abc",
"level": "200",
"source": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"message": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"userid": "12345",
"time": 1403283202000
}
}]}
}
When I do GET my_index/sync/_mapping
i get
{
"my_type": {
"mappings": {
"sync": {
"properties": {
"channel": {
"type": "string"
},
"id": {
"type": "string"
},
"level": {
"type": "string"
},
"message": {
"type": "string"
},
"source": {
"type": "string"
},
"time": {
"type": "long"
},
"userid": {
"type": "string"
}
}
}
}
}
}
So the mapping I put in _default is 'ignored' and ES just uses its own default mappings. The same behavior happens when I PUT the mapping instead of using the config/mappings/default/sync.json file.
Also kibana recognised that an index of my_index exists but cannot see any time fields in settings>configure_an_index_pattern,
Can anyone point me in the right direction please?