suryas16
(Suryas16)
May 3, 2020, 7:19am
1
I'm using spring data elasticsearch @Query annotation, i don't get the highlighted values returned from this query, it works fine on elasticsearch
{
"from":0,
"size":1,
"highlight": {
"fields": {
"code": {
"pre_tags": [
"<strong>"
],
"post_tags": [
"</strong>"
],
"fragment_size": 500,
"number_of_fragments": 3
},
"name": {
"pre_tags": [
"<strong>"
],
"post_tags": [
"</strong>"
],
"fragment_size": 500,
"number_of_fragments": 3
}
}
},
"query": {
"multi_match": {
"query": "xyz",
"fields": ["code^2", "name"],
"analyzer": "standard"
}
}
}
dadoonet
(David Pilato)
May 3, 2020, 8:47am
2
You should ask in spring data project then.
suryas16
(Suryas16)
May 3, 2020, 3:54pm
3
@dadoonet okay, did you know any forum for spring data and elasticsearch?
@smhdiu Hi Mohsin, I can't get the highlighted fields with this Repo query code, any thought on it, I'm using 4.0.0.RC2:
@Query("{\n" +
" \"multi_match\": {\n" +
" \"query\": \"?0\",\n" +
" \"fields\": [\n" +
" \"code^2\",\n" +
" \"name\"\n" +
" ],\n" +
" \"analyzer\": \"standard\"\n" +
" }\n" +
"}")
@Highlight(
fields = @HighlightField(
name = "['code','name']"),
parameters = @HighlightParameters(
preTags = "<strong>",
postTags = "</strong>",
fragmentSize = 500,
numberOfFragments = 3
)
)
List<CodeNames> findAllByCodeAndNameOrderByName(String code, Pageable pageable);
dadoonet
(David Pilato)
May 4, 2020, 12:48am
4
Apparently they are now using stackoverflow. https://stackoverflow.com/tags/spring-data
system
(system)
Closed
June 1, 2020, 12:48am
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.