0
votes

I'm using elasticsearch-5.4.1 and am unable to create a mapping for a custom type on my index. Basically I'm trying to create a document of a login to a system.

I created an index via curl curl -X PUT http://localhost:9200/userlogin

I can see it with curl -XGET 'localhost:9200/_cat/indices?v&pretty'

To create the mapping (which fails):

curl -XPUT 'http://localhost:9200/userlogin/_mapping/login' -H 'Content-Type: application/json' -d '
{"properties": {
    "username": {"type": "text"},
    "firstname": {"type": "text"},
    "lastname": {"type": "text"},
    "queue": {"type": "text"},
    "timestamp": {"type": "date"}
}}'

Error:

{"error":"MapperParsingException[No handler for type [text] declared on field [username]]","status":400}[root@gv-karaf-dev-1 elasticsearch-5.4.1]

According to https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html this is exactly how one is supposed to do this from what I understand. How is test not a thing I can use? Is there an alternative?

possible duplicate of No handler for type [text] declared on field [title] (python elasticsearch but there was no answer there

1
I'm able to create mapping. Which version of elastic search are you using?vinod_vh

1 Answers

1
votes

Are you sure you are connecting to an Elastic search 5.4 instance? From the error it looks like you are connecting to an older version (2.4 ?).

Try doing the following on your terminal and see if you are really connecting to 5.4 instance.

curl -XGET 'localhost:9200'