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()
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

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

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

ES在查询中发现无法匹配的字段类型_第1张图片

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

ES在查询中发现无法匹配的字段类型_第2张图片

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

ES在查询中发现无法匹配的字段类型_第3张图片

ES在查询中发现无法匹配的字段类型_第4张图片

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

ES在查询中发现无法匹配的字段类型_第5张图片

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

ES在查询中发现无法匹配的字段类型_第6张图片

你可能感兴趣的:(elasticsearch,大数据,搜索引擎)