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的脚本。

相关推荐
SeaTunnel14 分钟前
SeaTunnel 社区月报(5-6 月):全新功能上线、Bug 大扫除、Merge 之星是谁?
大数据·开源·bug·数据集成·seatunnel
时序数据说1 小时前
Java类加载机制及关于时序数据库IoTDB排查
java·大数据·数据库·物联网·时序数据库·iotdb
大数据CLUB3 小时前
基于spark的航班价格分析预测及可视化
大数据·hadoop·分布式·数据分析·spark·数据可视化
格调UI成品3 小时前
预警系统安全体系构建:数据加密、权限分级与误报过滤方案
大数据·运维·网络·数据库·安全·预警
reddingtons6 小时前
Adobe Firefly AI驱动设计:实用技巧与创新思维路径
大数据·人工智能·adobe·illustrator·photoshop·premiere·indesign
G皮T7 小时前
【Elasticsearch】全文检索 & 组合检索
大数据·elasticsearch·搜索引擎·全文检索·match·query·组合检索
Cachel wood9 天前
Spark教程6:Spark 底层执行原理详解
大数据·数据库·分布式·计算机网络·spark
Sally璐璐9 天前
数据标注工具详解
大数据·ai
云宏信息10 天前
金融vmware替换过程中关于利旧纳管、迁移、数据安全容灾备份、成本及案例|金融行业数字化QA合集④
大数据·运维·服务器·科技·金融·云计算
时序数据说10 天前
时序数据库IoTDB数据导入与查询功能详解
大数据·数据库·开源·时序数据库·iotdb