Hello All
hope you are doing fine
I have stumbled upon a bug and looking to seek advice from a community
Problem Statment
I want to highlight that "dreams may come"
Here is what elk return
PUT /test/_doc/_mappings
{
"_doc": {
"properties": {
"message": {
"type": "text",
"term_vector": "with_positions_offsets"
}
}
}
}
-----------------------------------------------------------------------------------------
POST /test/_doc/1
{
"message": "What dreams may come, when we have shuffled off this mortal coil, must give us pause."
}
-----------------------------------------------------------------------------------------
GET /test/_search
{
"query": {
"query_string": {
"query": "\"dreams may come\""
}
},
"highlight": {
"fields": {
"message": {
"type": "fvh",
"fragment_size": 40
}
}
}
}
-----------------------------------------------------------------------------------------
GET /test/_search
{
"query": {
"query_string": {
"query": "dreams may come"
}
},
"highlight": {
"fields": {
"message": {
}
}
}
}
Response
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "the field [message] should be indexed with term vector with position offsets to be used with fast vector highlighter"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "test",
"node" : "yVDfIKXoS-22rOCnplvhTg",
"reason" : {
"type" : "illegal_argument_exception",
"reason" : "the field [message] should be indexed with term vector with position offsets to be used with fast vector highlighter"
}
}
],
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "the field [message] should be indexed with term vector with position offsets to be used with fast vector highlighter",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "the field [message] should be indexed with term vector with position offsets to be used with fast vector highlighter"
}
}
},
"status" : 400
}
---------------------------------------------------------------------------------
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.8630463,
"hits" : [
{
"_index" : "test",
"_id" : "1",
"_score" : 0.8630463,
"_source" : {
"message" : "What dreams may come, when we have shuffled off this mortal coil, must give us pause."
},
"highlight" : {
"message" : [
"What <em>dreams</em> <em>may</em> <em>come</em>, when we have shuffled off this mortal coil, must give us pause."
]
}
}
]
}
}