Reputation: 903
The type of field version in following mapping is date. But the type of version listed on groups/_mapping is text. Is there anything wrong about the mapping or settings ? Thanks.
mapping:
PUT groups
{
"settings": {
"index.mapping.ignore_malformed": true
},
"mappings": {
"shop": {
"_all": { "enabled": false },
"dynamic": "false",
"date_detection" : false,
"properties": {
"sid": { "type": "keyword"},
"version": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}
}
the result for this is.
{
"acknowledged": true,
"shards_acknowledged": true
}
result from http://host:9200/groups/_mapping
{
"groups": {
"mappings": {
"shop": {
"properties": {
"sid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
Insert data as follow:
{'sid': '772634b9b9a8437f9cbfaec2b546f8af', 'version': '20131209 15:19:04'}
The response:
{
'_id': '772634b9b9a8437f9cbfaec2b546f8af',
'_index': 'groups_version',
'_shards': {'failed': 0, 'successful': 2, 'total': 2},
'_type': 'shop',
'_version': 1,
'result': 'created',
}
the asdas
Upvotes: 0
Views: 179
Reputation: 2208
I think I might know what is going on - in Kibana when you put an empty line between PUT group
and the body {}
it does not append the body to the reguest and the only request that is sent is:
curl -XPUT "http://localhost:9200/groups"
That is why you got standard mapping with text
. But if you remove the empty line everythnig is fine and this request is sent:
curl -XPUT "http://localhost:9200/groups" -H 'Content-Type: application/json' -d'
{ "body": {
"settings": {
"index.mapping.ignore_malformed": true
},
"mappings": {
"shop": {
"_all": { "enabled": false },
"dynamic": "false",
"date_detection" : false,
"properties": {
"sid": { "type": "keyword"},
"version": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}
}
}'
It is easy to check what is really sent when you click the "wrench" button, then "Copy as cURL" and paste it somewhere:
Upvotes: 1