curl -XPOST http://localhost:9200/tracy/person/_mapping -d'
{
"properties": {
"content": {
"type": "application/json",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
{
"properties": {
"content": {
"type": "application/json",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}'
执行报错:
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
解决:
curl -H "Content-Type: application/json" -XPOST http://localhost:9200/tracy/fulltext/_mapping -d'
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}'
原因:es6.0之后官方部分调整
https://www.elastic.co/blog/strict-content-type-checking-for-elasticsearch-rest-requests