Cheers for the update shay,
I'm more curious about the JsonFieldMapper that is obtained and called
when searching for the default field. i.e. for the mapping:
{
"stringtest" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : { type : "string", index :
"analyzed" },
"orig" : { type : "string", index :
"analyzed" },
"untouched" : {type: "string", index :
"not_analyzed"}
}
}
}
}
}
CountResponse countResponse1 =
server.client().count(countRequest("test").querySource(fieldQuery("name",
"123"))).actionGet();
CountResponse countResponse2 =
server.client().count(countRequest("test").querySource(fieldQuery("name.untouched",
"123"))).actionGet();
CountResponse countResponse3 =
server.client().count(countRequest("test").querySource(fieldQuery("name.orig",
"123"))).actionGet();
upon searching, the method JsonFieldMapper.indexedValue(String) is
called (to format the string for searching I guess). What I'm seeing
is the following:
name is assigned JsonLongFieldMapper
name.orig is assigned JsonStringFieldMapper
name.untouched is assigned JsonStringFieldMapper
Is this meant to happen, or should it be assigned
JsonStringFieldMapper. I'm just looking at plugin development in
0.6.0 (which is working well), and this is where my question is
stemming from.
cheers
/dom
On Apr 6, 11:33 pm, Shay Banon shay.ba...@elasticsearch.com wrote:
You are being modest :). There is a bug in the docs (just fixed it). The
idea is that any mapping unit a multi_field that is not using the same name
as the multi_field can be accessed by navigating through the multi_field
name.
So, the docs are wrong, have a look at the corrected ones (the change is to
rename name_untouched to untouched). In your case, since the extra field(s)
is called name_untouched, then you navigate to it using name.name_untouched.
If you change it to untouched, then name.untouched should work.
cheers,
shay.banon
On Tue, Apr 6, 2010 at 10:11 PM, dominict dominic.toot...@gmail.com wrote:
Say I have the following mapping :
{
"stringtest" : {
" properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : { type : "string" },
"name_untouched" : {type: "string"}
}
}
}
}
}
The JsonStringFieldMapper.indexedValue(String value) only gets called
for name_untouched, and not name. Should the JsonStringFieldMapper
used for both the default "name" and "name_untouched" fields?
Mapping setup via:
server.client().admin().indices().putMapping(putMappingRequest("test").mapp ingSource(mapping)).actionGet();
Document is indexed via:
server.client().index(indexRequest("test").type("stringtest").id("1")
.source(jsonBuilder().startObject().field("name",
"123").endObject())).actionGet();
server.client().admin().indices().refresh(refreshRequest()).actionGet();
then a count is done:
CountResponse countResponse =
client.count(countRequest("test").querySource(termQuery("name",
"123"))).actionGet();
CountResponse countResponse2 =
client.count(countRequest("test").querySource(termQuery("name.name_name",
"123"))).actionGet();
CountResponse countResponse3 =
client.count(countRequest("test").querySource(termQuery("name.name_untouche d",
"123"))).actionGet();
CountResponse countResponse4 =
client.count(countRequest("test").querySource(termQuery("name.name",
"123"))).actionGet();
CountResponse countResponse5 =
client.count(countRequest("test").querySource(termQuery("name.untouched",
"123"))).actionGet();
of the above 5 count operations only count 1 + 3 return the correct
count number of 1.
Should "name.untouched" also work?
It's probably a complete mis-reading of
http://www.elasticsearch.com/docs/elasticsearch/mapping/multi_field/
on my part.
cheers,
/dom