RequestError(400, 'parse_exception', 'unknown key [properties] for create index')
RequestError(400, 'parse_exception', 'unknown key [properties] for create index')
我正在尝试使用 python 创建一个 elasticsearch 索引,其内容是一系列坐标,以便稍后在 kibana 地图中可视化此数据。
很遗憾,我收到了这条错误消息:
RequestError(400, 'parse_exception', 'unknown key [properties] for create index')
这是我正在使用的代码:
es = Elasticsearch()
mappings = {
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="doc", body=es_entries)
到目前为止做得很好,您快完成了。需要进行一些更改:
mappings = {
"mappings": { <--- add this
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="_doc", body=es_entries)
^
|
modify this
我正在尝试使用 python 创建一个 elasticsearch 索引,其内容是一系列坐标,以便稍后在 kibana 地图中可视化此数据。
很遗憾,我收到了这条错误消息:
RequestError(400, 'parse_exception', 'unknown key [properties] for create index')
这是我正在使用的代码:
es = Elasticsearch()
mappings = {
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="doc", body=es_entries)
到目前为止做得很好,您快完成了。需要进行一些更改:
mappings = {
"mappings": { <--- add this
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="_doc", body=es_entries)
^
|
modify this