Reputation: 61
all. The python elasticsearch version I used is
import elasticsearch
print elasticsearch.__version__
(5, 0, 1)
the mappings is
request_body = {
'mappings':{
'post': {
'properties': {
'title': {
'type': 'text',
}
}
}
}
}
The error is :
{u'status': 400, u'error': {u'caused_by': {u'reason': u'No handler for type [text] declared on field [title]', u'type': u'mapper_parsing_exception'}, u'root_cause': [{u'reason': u'No handler for type [text] declared on field [title]', u'type': u'mapper_parsing_exception'}], u'type': u'mapper_parsing_exception', u'reason': u'Failed to parse mapping [post]: No handler for type [text] declared on field [title]'}}
Why es 5.0 can not recognize the "text" type? What's wrong with my setup? Thanks a lot!
Upvotes: 5
Views: 14925
Reputation: 7348
Upgrade to latest Elastic Search, I had some old version 2, there is now version 6 which supports [text]
Upvotes: 1
Reputation: 3005
analyzer is mandatory for type:text. Refer https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html
Upvotes: 2
Reputation: 777
There are a couple of issues in your mapping. Replace all the single quotes with double quotes and remove the ,
after the last line(field type definition.)
{
"mappings":{
"post":{
"properties":{
"title":{
"type":"text"
}
}
}
}
}
Upvotes: 2