10-11最后的es查询语句报错
来源:10-11 java搜索接入(7)
Vastzhang
2020-09-07
最后的es查询语句报错如下,使用的es版本和相关软件是7.9,请问老师这个是怎么回事呢?
2回答
-
Vastzhang
提问者
2020-09-07
删除了shop索引后,重新创建了一次就可以了,tags字段缺少了"fielddata":true属性
PUT /shop?include_type_name=false
{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 1
},
"mappings": {
"properties": {
"id":{"type":"integer"},
"name":{"type":"text","analyzer": "ik_max_word","search_analyzer":"ik_smart"},
"tags":{"type":"text","analyzer": "whitespace","fielddata":true},
"location":{"type":"geo_point"},
"remark_score":{"type":"double"},
"price_per_man":{"type":"integer"},
"category_id":{"type":"integer"},
"category_name":{"type":"keyword"},
"seller_id":{"type":"integer"},
"seller_remark_score":{"type":"double"},
"seller_disabled_flag":{"type":"integer"}
}
}
}
10 -
Vastzhang
提问者
2020-09-07
https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html
翻文档看到一个解决办法,但是报错了,请问是哪里有问题呢?
PUT shop/ / _mapping
{ "properties”:
{ “ tags”:
{
“ type”:“ text”,“ fielddata”:true
}
}
}
00
相似问题