Hello,
i have trouble getting highlight to work. Here is my script used for
testing:
init() {
curl -XDELETE http://localhost:9200/twitter
echo
curl -XPUT http://localhost:9200/twitter
echo
curl -XPUT http://localhost:9200/twitter/tweet/_mapping -d '{
"tweet" : {
"properties" : {
"user" : { "type" : "string" },
"message" : {
"type" : "string",
"index": "analyzed",
"store": "yes",
"term_vector" : "with_positions_offsets"
}
}
}
}'
echo
curl -XPOST http://localhost:9200/twitter/tweet -d '{
"user": "kimchy",
"message": "You know, for Search"
}'
echo
curl -XPOST http://localhost:9200/twitter/tweet -d '{
"user": "bar",
"message": "You know, foo for Search"
}'
echo
sleep 2
echo '-------------------'
}
[ "$1" = "init" ] && init
curl -X GET 'http://localhost:9200/twitter/_search/?pretty=true' -d '{
"query":{
"query_string":{
"query":"foo"
}
}
},
"highlight":{
"pre_tags": "",
"post_tags": "",
"fields" : {
"message" : {"number_of_fragments": 20}
}
}
}'
and here the output:
{"ok":true,"acknowledged":true}
{"ok":true,"acknowledged":true}
{"ok":true,"acknowledged":true}
{"ok":true,"_index":"twitter","_type":"tweet","_id":"aSAxiJwvTZCiAS0FV4Nnow"
,"_version":1}
{"ok":true,"_index":"twitter","_type":"tweet","_id":"pTYsw0FWQYOUMtzRAD7gSg"
,"_version":1}
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.09492774,
"hits" : [ {
"_index" : "twitter",
"_type" : "tweet",
"_id" : "pTYsw0FWQYOUMtzRAD7gSg",
"_score" : 0.09492774, "_source" : {
"user": "bar",
"message": "You know, foo for Search"
}
} ]
}
}%
as you can see there are no errors but the highlight property isn't there,
too.
Can someone see my mistake?
Regards,
Herman Fries
--