Open noobgod opened 5 years ago
explain的dsl:
{
"from": 0,
"size": 200,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"match_phrase": {
"id": {
"query": 374,
"slop": 0,
"zero_terms_query": "NONE",
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [],
"excludes": []
},
"script_fields": {
"id": {
"script": {
"source": "doc['communityId'].value",
"lang": "painless"
},
"ignore_failure": false
},
"cid": {
"script": {
"source": "doc['cityId'].value",
"lang": "painless"
},
"ignore_failure": false
}
}
}
我想给我的查询字段起别名,但是好像不起作用,我的 SQL 如下:
http://localhost:9200/_sql?sql=select communityId as id, cityId as cid from t_house_short_v11 where id = 374。
其中communityId 的别名是 id, cityId 的别名是cid,但是查询结果是所有字段:
"hits": [ { "_index": "t_house_short_v11", "_type": "t_house_short", "_id": "374", "_score": 0, "_source": { "id": 374, "code": null, "houseType": 1000, "houseSubType": 1000001, "coverImageUrl": null, "communityId": 25325, "communityName": "景江苑", "communityFirstPinyin": "jjy", "communityPinyin": "jingjiangyuan", "cityId": 1, "metroLineIds": null, "metroStationIds": null, "longitude": "121.4947361827572", "latitude": "31.078427239528086", "location": "31.078427239528086,121.4947361827572", "regionId": 310112, "regionName": "闵行区", "regionFirstPinyin": "mxq", "regionPinyin": "minxingqu", "blockId": 1000308, "blockName": "浦江", "blockFirstPinyin": "pj", "blockPinyin": "pujiang", "title": "景江苑公寓", "titleFirstPinyin": "jjygy", "rentType": 1, "buildingName": "35", "unitName": "3", ... }
想问下:这种起别名的方式不支持吗?