Multi_field mapping


(James de Vries) #1

I have been experimenting with attempting to make a single field searchable
when analyzed, and when not analyzed. According to the docs, the multi
field typehttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-multi-field-type.htmlis the tool for the job. In place of the old mapping for that field, which
was simply:
{"myfieldname" : { "type":"string"}}
I have set it to be the following, through the put mapping API:
{
"mytype" : {
"properties" : {
"myfieldname" : {
"type" : "multi_field",
"fields" : {
"myfieldname" : {"type" : "string", "index" :
"not_analyzed"},
"myfieldname_special" : {
"type" : "string",
"index" : "analyzed",
"analyzer":"phonetic",
}
}
}
}
}
}

It is my understanding that "analyzer" sets both search_analyzer and
index_analyzer, so I did curl -XPOST
'http://localhost:9200/myindex/_refresh' to rebuild the index. However any
query over myfieldname_special returns zero results :frowning:
I am not sure what it is that i've missed. Could anybody help me out?

--
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/e3155fab-5702-4076-9c82-63c681e108a8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Radu Gheorghe) #2

Hi James,

I think that by default you have to refer to that field as
"myfieldname.myfieldname_special", while the other one can simply be
"myfieldname", since it's the "default" name. You can set the "path" option
to "just_name" to be able to refer it via myfieldname_special.

Best regards,
Radu

On Sun, Dec 1, 2013 at 4:04 PM, James de Vries shadylives@gmail.com wrote:

I have been experimenting with attempting to make a single field
searchable when analyzed, and when not analyzed. According to the docs, the multi
field typehttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-multi-field-type.htmlis the tool for the job. In place of the old mapping for that field, which
was simply:
{"myfieldname" : { "type":"string"}}
I have set it to be the following, through the put mapping API:
{
"mytype" : {
"properties" : {
"myfieldname" : {
"type" : "multi_field",
"fields" : {
"myfieldname" : {"type" : "string", "index" :
"not_analyzed"},
"myfieldname_special" : {
"type" : "string",
"index" : "analyzed",
"analyzer":"phonetic",
}
}
}
}
}
}

It is my understanding that "analyzer" sets both search_analyzer and
index_analyzer, so I did curl -XPOST '
http://localhost:9200/myindex/_refresh' to rebuild the index. However any
query over myfieldname_special returns zero results :frowning:
I am not sure what it is that i've missed. Could anybody help me out?

--
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/e3155fab-5702-4076-9c82-63c681e108a8%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/

--
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/CAHXA0_2sX6xRARQRm3HqRVJz%2BgjP5-T2oKMgTQY5kTs31Nwt%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3