私はこの文書を持っている:、それは安全ではない含まれているすべての結果を返しますElasticSearchクエリフィールドに値がありますか?
{
"query":{
"query_string": {
"query": "unsafe"
}
}
}
しかし:私はこのクエリを実行する場合、私は、contributing_factor_vehicle
はテキストunsafe
が含まれているフィールドすべてのそれらを取得したい
{
"took": 1,
"timed_out": false,
"_shards": {...},
"hits": {
"total": 20584,
"max_score": 8.143582,
"hits": [
{
"_index": "nyc_visionzero",
"_type": "logs",
"_id": "AVwMozs3iTTcr81oIxfl",
"_score": 8.143582,
"_source": {
"date": "02/12/2017",
"number_of_motorist_injured": 2,
"contributing_factor_vehicle": "Unsafe Speed",
}
...
フィールドcontributing_factor_vehicle
に限定したい。
更新マッピング
{
"nyc_visionzero": {
"mappings": {
"logs": {
"_all": {
"enabled": true
},
"dynamic_templates": [
{
"string_fields": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"fields": {
"raw": {
"ignore_above": 256,
"type": "keyword"
}
},
"omit_norms": true,
"type": "text"
}
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "keyword"
},
"borough": {
"type": "keyword"
},
"contributing_factor_vehicle": {
"type": "keyword"
},
"coords": {
"type": "geo_point"
},
"cross_street_name": {
"type": "keyword"
},
"date": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"host": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"hour_of_day": {
"type": "integer"
},
"intersection": {
"type": "keyword"
},
"latitude": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"location": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"longitude": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"message": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"number_of_cyclist_injured": {
"type": "long"
},
"number_of_cyclist_killed": {
"type": "long"
},
"number_of_motorist_injured": {
"type": "long"
},
"number_of_motorist_killed": {
"type": "long"
},
"number_of_pedestrians_injured": {
"type": "long"
},
"number_of_pedestrians_killed": {
"type": "long"
},
"number_of_persons_injured": {
"type": "long"
},
"number_of_persons_killed": {
"type": "long"
},
"number_persons_impacted": {
"type": "long"
},
"off_street_name": {
"type": "keyword"
},
"on_street_name": {
"type": "keyword"
},
"query": {
"properties": {
"match_all": {
"type": "object"
}
}
},
"tags": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"time": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"unique_key": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"vehicle_type": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
},
"zip_code": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
Iは ' "default_field" 追加しようとした "contributing_factor_vehicleを"'と私は ' "ヒット" を得る:{ "合計":0、 「max_score ":null、 "ヒット ":[] } – commonSenseCode
マッピングを共有できますか? 'GET index/type/_mapping' – Richa
元の投稿の更新をご覧ください – commonSenseCode