I'm trying to use fvh with span_near queries but it appears to be totally
broken. Other query types work, even it's query_string equivalent. Is
there anything I am doing incorrectly here? Or is there a work around that
I can employ in the meantime? Below is a recreation:
Set up index with mappings
curl -XPOST localhost:9200/a -d '{
"mappings": {
"document": {
"properties": {
"text": {
"type": "string",
"term_vector": "with_positions_offsets"
}
}
}
}
}'
Put text to field with positions offsets
curl -XPOST localhost:9200/a/document/1 -d '{"text": "a b"}'
Query with fvh highlighter gives no highlight
curl -XPOST localhost:9200/a/document/_search -d '{
"query": {
"span_near": {
"slop": 0,
"clauses": [{"span_term": {"text": "a"}}, {"span_term": {"text": "b"}}]
}
},
"highlight": {"fields": {"text": {"type":"fvh"}}}
}'
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.22145195,"hits":[{"_index":"a","_type":"document","_id":"1","_score":0.22145195, "_source" : {"text": "a b"}}]}}
Query with plain
curl -XPOST localhost:9200/a/document/_search -d '{
"query": {
"span_near": {
"slop": 0,
"clauses": [{"span_term": {"text": "a"}}, {"span_term": {"text": "b"}}]
}
},
"highlight": {"fields": {"text": {"type":"plain"}}}
}'
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.22145195,"hits":[{"_index":"a","_type":"document","_id":"1","_score":0.22145195, "_source" : {"text": "a b"},"highlight":{"text":["a b"]}}]}}
curl -XPOST localhost:9200/a/document/_search -d '{
"query": {
"query_string": {
"query": ""a b"~0",
"default_field": "text"
}
},
"highlight": {"fields": {"text": {"type":"fvh"}}}
}'
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.38356602,"hits":[{"_index":"a","_type":"document","_id":"1","_score":0.38356602, "_source" : {"text": "a b"},"highlight":{"text":["a b"]}}]}}
Try a match query
curl -XPOST localhost:9200/a/document/_search -d '{
"query": {
"match": {
"text": "a b"
}
},
"highlight": {"fields": {"text": {"type":"fvh"}}}
}'
{"took":14,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.2712221,"hits":[{"_index":"a","_type":"document","_id":"1","_score":0.2712221, "_source" : {"text": "a b"},"highlight":{"text":["a b"]}}]}}
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bc11d0c7-119b-410d-9fb4-ee4c72c6ee5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.