Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error in Elasticsearch while creating index using postman

I have installed Elasticsearch 5.1 in ubuntu 14.04. I have performed some operations in Elasticsearch like create index, delete index etc. Then I have installed Kibana 5.1. Now I want to create new index in elasticsearch using postman (localhost:9200/my_index with PUT). But I'm getting this error.

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
  },
  "status": 400
}

I remember that I have used country as index or type. But then I have purged elasticsearch and kibana (also deleted directories related to those). Reinstalled both. But still getting this error. If anyone knows the solution, it will be appreciated.

Here is output of some query which may you need to solve issue.

GET localhost:9200/_mapping

{ ".kibana": { "mappings": { "server": { "properties": { "uuid": { "type": "keyword" } } }, "config": { "properties": { "buildNum": { "type": "keyword" } } } } } }

(GET) localhost:9200/_cat/indices?v

[ { "health": "yellow", "status": "open", "index": ".kibana", "uuid": "O_ORG0ONQNCEe8JU_C0SKQ", "pri": "1", "rep": "1", "docs.count": "1", "docs.deleted": "0", "store.size": "3.1kb", "pri.store.size": "3.1kb" } ]

(GET) localhost:9200/country

{ "error": { "root_cause": [ { "type": "index_not_found_exception", "reason": "no such index", "resource.type": "index_or_alias", "resource.id": "country", "index_uuid": "na", "index": "country" } ], "type": "index_not_found_exception", "reason": "no such index", "resource.type": "index_or_alias", "resource.id": "country", "index_uuid": "na", "index": "country" }, "status": 404 }

like image 229
Akshay Vaghasiya Avatar asked Dec 14 '16 08:12

Akshay Vaghasiya


1 Answers

You can simply have a PUT request as such:

http://localhost:9200/indexname <--- give your index name

And then within your request body you could give the mappings:

{
  "mappings": {
    "message_logs": {
      "properties": {
        "anyfield": { <-- give your field
          "type": "text" <-- and the type
        }
      }
    }
  }
}

This SO might help you if you're willing to create the index using CURL. The above is just a sample. You could reproduce it.

like image 121
Kulasangar Avatar answered Nov 13 '22 09:11

Kulasangar