问题已解决,后面在持续更新es相关问题

环境

elasticsearch7.* 遇到的问题

异常

    "type" : "parse_exception",
    "reason" : "unknown key [setting] for create index"

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parse_exception",
        "reason" : "unknown key [mapping] for create index"
      }
    ],
    "type" : "parse_exception",
    "reason" : "unknown key [mapping] for create index"
  },
  "status" : 400
}

解决办法

原因:索引构建问题,仔细核对是否和我的索引格式一致,有问题欢迎留言。

1.curl方式

curl - H "Content-Type: application/json" - XPUT 'http://127.0.0.1:9200/temporary_index_test1' - d '{
"settings": {
	"index": {
		"number_of_shards": 5,
		"number_of_replicas": 1
	}
},
"mappings": {
	"properties": {
		"news_id": {
			"type": "long"
		},
		"news_title": {
			"type": "text"
		},
		"news_content": {
			"type": "text"
		}
	}
}
}'

2.插件方式

elasticsearch异常问题_Elasticsearch

{
	"settings": {
		"index": {
			"number_of_shards": 5,
			"number_of_replicas": 1
		}
	},
	"mappings": {
		"properties": {
			"news_id": {
				"type": "long"
			},
			"news_title": {
				"type": "text"
			},
			"news_content": {
				"type": "text"
			}
		}
	}
}