我正在使用邮递员与elasticsearch服务器进行通信,当我尝试与我的elasticsearch服务器连接时,我在邮递员中收到错误消息。我哪里出问题了?这是我的代码。
{ "mappings": { "post": { "properties": { "city": { "type": "text" }, "contact_email": { "type": "text" }, "country": { "type": "text" }, "description": { "type": "text" }, "image": { "type": "text" }, "post_id": { "type": "text" }, "state_province": { "type": "text" }, "title": { "type": "text" } } } } }
我已尝试与服务器通信,但我一直收到此错误
"root_cause": [ { "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [post : {properties={country={type=text}, image={type=text}, post_id={type=text}, city={type=text}, description={type=text}, state_province={type=text}, title={type=text}, contact_email={type=text}}}]" }
好像您使用的是Elasticsearch 7.0版。由于Elasticsearch每个索引不再支持一种以上的映射类型,因此不再需要映射名称,并且此版本中不应提供该名称。post从json输入中删除映射名称。用途如下:
post
{ "mappings": { "properties": { "city": { "type": "text" }, "contact_email": { "type": "text" }, "country": { "type": "text" }, "description": { "type": "text" }, "image": { "type": "text" }, "post_id": { "type": "text" }, "state_province": { "type": "text" }, "title": { "type": "text" } } } }