My JSON doc is like this:我的JSON文档如下:
{
"query" : {
"bool": {
"minimum_should_match": 1,
"should": [
{
"bool": { "must": [{"match": {"txt": "p"}},
{"match": {"nm": "p"}}
]
}
},
{
"bool": { "must": [{"match": {"txt": "p"}}
]
}
},
{
"bool": { "must": [{"match": {"nm": "p"}}
]
}
}
]
}
},
"highlight": {
"number_of_fragments" : 1,
"order": "score",
"boundary_scanner": "sentence",
"fragment_size" : 300,
"pre_tags" : ["<tag1>"],
"post_tags" : ["</tag1>"],
"fragmenter": "span",
"fields" : {
"nm": {},
"txt": {}
}
},
"_source": false
}
字符串
How should I write the query method using @Query annotation?(or if there is any other method that I can put the highlight)?我应该如何使用@Query注解编写查询方法?(或者是否有任何其他方法可以突出显示)?
observation:highlight it's very important观察:突出显示它非常重要
Thanks for any suggestion.感谢您的任何建议。
1条答案
按热度按时间exdqitrt1#
你应该把查询部分放到
@Query
注解中,参见相关文档。对于高亮定义,可以使用
@Highlight
注解,查看参考文档