赞
踩
Elasticsearch 6 创建索引报错:
Invalid index name [testDemo], must be lowercase
原因:Elasticsearch 6 默认索引类型是_doc,如果想改变则要指定索引类型
示例:
- PUT testDemo
- {
- "mappings": {
- "properties": {
- "name": {
- "type": "text"
- },
- "location": {
- "type": "geo_point"
- }
- }
- }
- }
返回:
- {
- "error": {
- "root_cause": [
- {
- "type": "invalid_index_name_exception",
- "reason": "Invalid index name [testDemo], must be lowercase",
- "index_uuid": "_na_",
- "index": "testDemo"
- }
- ],
- "type": "invalid_index_name_exception",
- "reason": "Invalid index name [testDemo], must be lowercase",
- "index_uuid": "_na_",
- "index": "testDemo"
- },
- "status": 400
- }

指定索引类型:
- PUT testDemo
- {
- "mappings": {
- "product": {
- "properties": {
- "name": {
- "type": "text"
- },
- "location": {
- "type": "geo_point"
- }
- }
- }
- }
- }
结果:
- {
- "acknowledged" : true,
- "shards_acknowledged" : true,
- "index" : "testDemo"
- }
product为指定索引类型
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。