ES在查询中发现无法匹配的字段类型

复制代码
2023-12-19 09:15:23,059 [ERROR] [http-nio-8301-exec-1] [hbaseReader-1077] e.b.es.service.impl.EsQueryImpl - matchQuery error:
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
        at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
        at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1406)
        at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1382)
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1269)
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1231)
        at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:730)
        at exsun.bigdata.es.service.impl.EsQueryImpl.geoPolygonWithDateQuery(EsQueryImpl.java:113)
        at exsun.bigdata.es.service.impl.EsQueryImpl$$FastClassBySpringCGLIB$$569d606c.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

A.检查一下ES的版本跟代码是否匹配(一般是ok的)

B.检查一下ES中的索引和配置文件的名称是否一致;

C.检查是否导入索引类型

ES导入脚本如下:

复制代码
PUT /1077_dvo_gps_data_relation_online
{
  "settings": {
    	"number_of_shards": 1,
    	"number_of_replicas": 1
    },
    "mappings": {
      "_doc": {
        "properties": {
		      "lat": {"type": "float"},
          "lng": {"type": "float"},
          "lngAndLat": {"type": "geo_point"},
          "hgt": {"type": "integer"},
          "spd": {"type": "integer"},
          "dre": {"type": "integer"},
          "gte": {"type": "long"},
          "gdt": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"},
          "mie": {"type": "integer"},
          "kilometer":{"type": "float"},
          "poi": {"type": "object"},
          "alm": {"type": "text"},
          "amm": {"type": "long"},
          "sts": {"type": "text"},
          "stm": {"type": "long"},
          "pop": {"type": "object"},
          "adl": {"type": "object"},
          "cnt": {"type": "integer"},
          "ons": {"type": "integer"},
          "mid": {"type": "integer"},
          "dvo": {"type": "keyword"},
          "pte": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"},
          "tpc": {"type": "text"},
          "vehicleName": {"type": "text"},
          "vehicleId": {"type": "keyword"},
          "numberPlate": {"type": "text","fields": {"keyword":{"type":"keyword","ignore_above": 256}}},
          "companyId": {"type": "long"},
          "companyName": {"type": "text"},
          "driverInfo":{"type": "object"},
          "vehicleType":{"type": "integer"},
          "dayKMeter":{"type": "float"},
          "bindName":{"type":"text"},
          "objType":{"type":"integer"},
          "adress":{"type":"text"},
          "lastTime_lngAndLat": {"type": "geo_point"},
          "lastTime_gte": {"type": "long"},
          "lastTime_gdt": {"type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"}
        }
      }
    }
}

导入方式:

先进入ambari平台,点击'++++Kibana++++'->'[++++Kibana UI++++](#Kibana UI)'

点击'Management'->'Index management'进入到查询页面

如果发现缺少index或者缺少index对应的类型,可以选择先删除索引

再从'Dev Tools'工具中执行上面的index的脚本。

相关推荐
零售ERP菜鸟27 分钟前
IT价值证明:从“成本中心”到“增长引擎”的确定性度量
大数据·人工智能·职场和发展·创业创新·学习方法·业界资讯
叫我:松哥31 分钟前
基于大数据和深度学习的智能空气质量监测与预测平台,采用Spark数据预处理,利用TensorFlow构建LSTM深度学习模型
大数据·python·深度学习·机器学习·spark·flask·lstm
珠海西格电力7 小时前
零碳园区有哪些政策支持?
大数据·数据库·人工智能·物联网·能源
LJ97951117 小时前
AI如何重构媒介宣发:从资源博弈到智能匹配的技术跃迁
大数据
长路 ㅤ   8 小时前
ES索引切分方案4:索引+别名 应用层自己维护:时间序列索引
elasticsearch·索引模板·时间序列索引·别名系统·大数据优化
数据皮皮侠AI8 小时前
上市公司股票名称相似度(1990-2025)
大数据·人工智能·笔记·区块链·能源·1024程序员节
Zoey的笔记本9 小时前
金融行业数据可视化平台:破解数据割裂与决策迟滞的系统性方案
大数据·信息可视化·数据分析
2501_933670799 小时前
大数据与财务管理专业就业岗位方向
大数据
小龙10 小时前
【Git 报错解决】本地分支与远程分支名称/提交历史不匹配
大数据·git·elasticsearch·github
Deepoch10 小时前
Deepoc具身模型:破解居家机器人“需求理解”难题
大数据·人工智能·机器人·具身模型·deepoc