1
我的映射:如何在Elasticsearch中突出顯示日期字段?
"mappings": {
"my_type": {
"properties": {
"birthDate": {
"type": "date",
"format": "dateOptionalTime"
},
"name": {
"type": "string"
}
}
}
}
我的搜索查詢:
GET my_index/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"name": "babken"
}
},
{
"term": {
"birthDate": {
"value": "1999-01-01"
}
}
}
]
}
},
"highlight": {
"fields": {
"*": {}
}
}
}
但是在響應體中,只有name
字段高亮顯示,即使birthDate
領域已經匹配,以及:
"hits": [
{
"_index": "my_index",
"_type": "my_type",
"_id": "1a82fbb4-1268-42b9-9999-ef932f67a114",
"_score": 12.507131,
"_source": {
"name": "babken",
"birthDate": "1999-01-01",
},
"highlight": {
"name": [
"<em>babken</em>"
]
}
}
...
如何使「birthDate
」字段顯示在「突出顯示」結果中,以及它是否匹配?
我使用Elasticsearch 1.6
這沒有幫助嗎? – keety