Index templates not working


(Univ) #1

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


(Univ) #2

Update: I posted the full commands used here : http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J
Still not working, can't understand why.

On May 12, 3:36 pm, Univ pierre.ma...@gmail.com wrote:

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


(Shay Banon) #3

After a discussion on the mailing list, the two problems were typo in the properties name, and term_vector value.
On Thursday, May 12, 2011 at 11:42 PM, pierre.matri@gmail.com wrote:

Update: I posted the full commands used here : http://paste.ofcode.org/37kruLNZ6jxTZUF464iMB2J
Still not working, can't understand why.

On May 12, 3:36 pm, Univ pierre.ma...@gmail.com wrote:

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


(system) #4