Hello,
I have a few problems getting started with index templates, which
don't seem to be working for me. I can't find where I made a mistake,
and a little help would be very welcome :
Index template
{
'template': 'cy-data-w*',
'mappings': {
'gitem': {
'propreties': {
'name': {
'index': 'analyzed',
'term_vector': 'with_position_offset',
'type': 'string'
},
'desc': {
'index': 'analyzed',
'term_vector': 'with_position_offset',
'type': 'string'
},
'location': {
'type': 'geo_point'
},
'language': {
'type': 'string',
'index': 'not_analyzed'
},
'visibility': {
'type': 'string',
'index': 'not_analyzed'
},
'policy': {
'type': 'string',
'index': 'not_analyzed'
},
'owner': {
'type': 'string',
'index': 'not_analyzed'
},
'created': {
'type': 'date',
'format': 'date_optional_time'
},
'status': {
'type': 'string',
'index': 'not_analyzed'
},
'type': {
'type': 'string',
'index': 'not_analyzed'
},
'item_count': {
'type': 'integer'
}
}
}
}
}
Sample indexed object in index cy-data-w2157
{
'status': 'n',
'visibility': 'v',
'language': 'fr',
'item_count': 0,
'owner': '4d122c9e777c577643000000',
'desc': null,
'name': 'AJS Ouistreham Handball',
'created': '2011-05-11T16:36:20.237000',
'location': [40.847059999999999, -111.884766],
'policy': 'o',
'type': 'g'
}
Command to add the template
curl -XPUT localhost:9200/_template/cy-data -d [mapping]
{"ok":true,"acknowledged":true}
After indexing an object, I get the mapping
curl -XGET 'http://localhost:9200/cy-data-w2157/gitem/_mapping?pretty=true'
{
"gitem" : {
"properties" : {
"type" : {
"type" : "string"
},
"item_count" : {
"type" : "long"
},
"location" : {
"type" : "double"
},
"status" : {
"type" : "string"
},
"visibility" : {
"type" : "string"
},
"created" : {
"format" : "dateOptionalTime",
"type" : "date"
},
"name" : {
"type" : "string"
},
"owner" : {
"type" : "string"
},
"policy" : {
"type" : "string"
},
"language" : {
"type" : "string"
}
}
}
}
Thanks for your help!
--
Pierre