如果使用高亮,Elasticsearch将显示匹配的术语:
curl -XGET http://localhost:9200/products/product/_search?pretty -d '{ "query" : { "fuzzy" : { "value" : "tpad" } }, "highlight": { "fields" : { "value" : {} } }}'Elasticsearch将返回匹配的文档,并突出显示该片段:
{ "took" : 31, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : 0.13424811, "hits" : [ { "_index" : "products", "_type" : "product", "_id" : "10", "_score" : 0.13424811, "_source":{ "value" : ["Ipad", "Apple", "Air", "32 GB" ]}, "highlight" : { "value" : [ "<em>Ipad</em>" ] } } ] }}


