Hi Yang,
I have found the solution that worked for me. Follow the gist here
http://elasticsearch-users.115913.n3.nabble.com/need-count-of-terms-using-facets-taking-space-into-account-td3956699.html#a3964932
Try analyser:keyword instead of index:not_analyzed in mapping.
curl -XPUT http://localhost:9200/_all/_mapping -d " {fullword : {properties
: {username : {type : """string""", analyzer : """keyword"""}}}}"
Honestly i haven't understood in details. But it worked for me so far.
Anjesh.
On 5 May 2012 23:13, Yang yuyang030405@gmail.com wrote:
And also, the error told me to set "mapping type", do you know how I could
put it via the url below?
C:>curl -XPUT http://localhost:9200/_all/_**mappinghttp://localhost:9200/_all/_mapping -d
" {fullword : {properties : {username : {type : """string""", index :
"""not_analyzed"""}}}}"On Sunday, May 6, 2012 1:24:37 AM UTC+8, Yang wrote:
WOW~~
Thanks anjesh for replying so quick.
I read the info you gave, we do meet the same problem, and it seems there
is no final solution, right?On Sunday, May 6, 2012 1:09:08 AM UTC+8, anjesh wrote:
I think this is what you are looking. I had a similar problem.
http://elasticsearch-users.115913.n3.nabble.com/
need-count-of-terms-using-facets-taking-space-into-
account-td3956699.html#**a3964087http://elasticsearch-users.115913.n3.nabble.com/need-count-of-terms-using-facets-taking-space-into-account-td3956699.html#a3964087Best
AnjeshOn 5 May 2012 22:38, Yang yuyang030405@gmail.com wrote:
Dear all,
I'm playing with facet of ES, it's very convenience for my sub
navigation.But here I meet a problem:
my data just like:
{"username":"jacky sun", "mname":"abc1.mp4", "mtype":"mp4"}
{"username":"jacky sun", "mname":"abc2.mp4", "mtype":"mp4"}
{"username":"jacky sun", "mname":"abc3.mp4", "mtype":"mp4"}
{"username":"jacky sun", "mname":"abc4.mp4", "mtype":"mp4"}{"username":"yang sun", "mname":"abc1.rmvb", "mtype":"rmvb"}
{"username":"yang sun", "mname":"abc2.rmvb", "mtype":"rmvb"}
{"username":"yang sun", "mname":"abc3.rmvb", "mtype":"rmvb"}
{"username":"yang sun", "mname":"abc4.rmvb", "mtype":"rmvb"}
{"username":"yang sun", "mname":"abc5.rmvb", "mtype":"rmvb"}//I just execute the es java api like below:
TermsFacetBuilder facetUN = new TermsFacetBuilder("username");
facetUN.fields("username");
TermsFacetBuilder facetMT = new TermsFacetBuilder("mtype");
facetMT.fields("mtype");
...
searchRequest.addFacet(**facetUN);
searchRequest.addFacet(**facetMT);
... execute search request and get the responseI just want to get a facet result like this:
username:
jacky sun(4)
yang sun(5)
media type:
mp4(4)
rmvb(5)But the actual result is:
username:
sun(9)
jacky(4)
yang(5)
media type:
mp4(4)
rmvb(5)Then I realized "jacky sun" had been tokenized.
After I saw the info under http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/index-modules/**analysis/keyword-analyzer.htmlhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html
** , it's telling me to set the field(username) as "not_analyzed".Because I don't know how to set it via java client, I just execute the
setting request like this on Win7:C:>curl -XPUT http://localhost:9200/_all/_**mappinghttp://localhost:9200/_all/_mapping-d " {fullword : {properties : {username : {type : """string""", index :
"""not_analyzed"""}}}}"Then I got the error:
{"error":"ActionRequestValidationException[Validation Failed: 1:
mapping type is missing;]","status":500}Could anybody tell me where could I put the "mapping type" or "type" in
the url above?Or is there any other way to make "jacky sun" not to be tokenized?
thanks,
--
Yang
--