Created
February 21, 2011 14:29
-
-
Save resetdel/837120 to your computer and use it in GitHub Desktop.
ES: demo for highlight bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT 'http://localhost:9200/testme/testme' -d '{ | |
streamType: "Feed", | |
tenantId: "1", | |
message: "bla bla bla post bla bla 1 bla", | |
description: "Description", | |
postDate:"2010-06-03T21:11:09+0300" | |
}' | |
curl -XPOST 'http://localhost:9200/testme/testme/_search' -d '{ sort:{postDate:{reverse:true}}, size:100, query : { bool : {must : [ {wildcard : { message : "*post*" }}, {term : { tenantId : "1" }} ] }} ,"highlight" : { "pre_tags" : ["<em class='highlight'>"], "post_tags" : ["</em>"], "fields" : {"message" : {"fragment_size" : 200, "number_of_fragments" : 1}}}}' | |
Response: | |
{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"testme","_type":"testme","_id":"1gf-JGBaTHKIiIUzBRCKNw","_score":null, "_source" : { | |
streamType: "Feed", | |
tenantId: "1", | |
message: "bla bla bla post bla bla 1 bla", | |
description: "Description", | |
postDate:"2010-06-03T21:11:09+0300" | |
},"highlight":{"message":["bla bla bla <em class='highlight'>post</em> bla bla <em class='highlight'>1</em> bla"]},"sort":[1275588669000]}]}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is that
tenantId: 1
is part of your query, when actually you want to filter by that field.Try this instead: