0

I am receiving an exception when trying to create an index, along with a mapping. I am issuing a PUT to my local ElasticSearch instance (v. 5.1.1) http://127.0.0.1:9200/indexname with the following body

{
  "settings": {
    "index": {
      "number_of_replicas": "1",
      "number_of_shards": "1"
    }
  },
  "mappings": {
    "examplemapping": {
      "properties": {
        "titel": {
          "type": "text",
          "index": false
        },
        "body": {
          "type": "text"
        },
        "room": {
          "type": "text",
          "index": false
        },
        "link": {
          "type": "text",
          "index": false
        }
      }
    }
  }
}

I receive the following error

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "No handler for type [text] declared on field [body]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [examplemapping]: No handler for type [text] declared on field [body]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "No handler for type [text] declared on field [body]"
    }
  },
  "status": 400
}

From the documentation on index creation it should be possible to create an index, and create one or more mappings at the same time: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

I have read https://www.elastic.co/guide/en/elasticsearch/reference/current/string.html and believe that I am correctly using the new datatype, but the exception suggests otherwise.

Any help is greatly appreciated.

Resolution

Thanks to a comment by Val i was pointed in the right direction. Indeed I was not using version 5.1.1, but version 2.4.3

So why the confusion? Well, I have been running both versions (not at once), and startet and stopped them using the respective bat scripts:

call es-2.4.3/bin/service.bat start
call es-5.1.1/bin/elasticsearch-service.bat start

It seems that even though I have been running the latter, it was still ES2.4.3 that was started. This is probably caused by the logic inside the bat script.

Going forward I will keep in mind to check the version response from the service itself, and I'm gonna have to find a proper setup to run multiple versions of ElasticSearch.

Thanks for the answers.

darkdark
  • 249
  • 1
  • 3
  • 16
  • 1
    Are you sure that you're running ES 5.1.1? what does `curl -XGET localhost:9200/` tell you? – Val Mar 07 '17 at 12:10
  • the error is trying to say that elastic is not able to find handler for text, Can you please recheck your version as elastic 5.1.1 supports text – user3775217 Mar 07 '17 at 12:35

2 Answers2

0

I tried your settings on ElasticSeach 5.0.0 and it worked fine, output of GET indexname :

{
  "indexname": {
    "aliases": {},
    "mappings": {
      "examplemapping": {
        "properties": {
          "body": {
            "type": "text"
          },
          "link": {
            "type": "text",
            "index": false
          },
          "room": {
            "type": "text",
            "index": false
          },
          "titel": {
            "type": "text",
            "index": false
          }
        }
      }
    },
    "settings": {
      "index": {
        "creation_date": "1488892255496",
        "number_of_shards": "1",
        "number_of_replicas": "1",
        "uuid": "GugRGgllQbCadCTj5oq4ow",
        "version": {
          "created": "5000099"
        },
        "provided_name": "testo"
      }
    }
  }
}

Also please note that I would definitely recommend that you set a different value of "number_of_shards": "1" as a rule of thumb consider that Elasticsearch is allocating 1 thread per shard, and thus the bigger your shard will become, the slower the text search will be. Now also bear in mind that some overhead comes from allocating more shards, so don't "overallocate". See this post and this onefor more details.

Community
  • 1
  • 1
Adonis
  • 4,670
  • 3
  • 37
  • 57
0

Thanks to a comment by Val i was pointed in the right direction. Indeed I was not using version 5.1.1, but version 2.4.3

So why the confusion? Well, I have been running both versions (not at once), and startet and stopped them using the respective bat scripts:

call es-2.4.3/bin/service.bat start
call es-5.1.1/bin/elasticsearch-service.bat start

It seems that even though I have been running the latter, it was still ES2.4.3 that was started. This is probably caused by the logic inside the bat script.

Going forward I will keep in mind to check the version response from the service itself, and I'm gonna have to find a proper setup to run multiple versions of ElasticSearch.

Thanks to all who pitched in!

darkdark
  • 249
  • 1
  • 3
  • 16