Specific analyzer per document


(lyes zaiko) #1

Hi all!

I have read in the api documentation that we can set a specific analyzers
fir a document by setting the "_analyzer" property in the mapping like this:

{
"type1" : {
"_analyzer" : {
"path" : "my_field"
}
}
}

so if I set the analyzer I want to use a specific analyzer dor a document,
I have to set the value of "my_field" to its name.

I tried this for my cas, but it does not seem to work

so my mapping is :

{"content": {
"_source" : {"enabled" : true},
"_uid" : {"index" : "no", "store" : "no"},
"_id" : {"index" : "no", "store" : "yes"},
"_analyzer" : {"path" : "my_anal", "index" : "no"},
"_index" : {"enabled" : true, "index" : "no", "store" :
"yes"},
"properties" : {

"body" : {"type" : "string",
"store" : "yes",

                      "index" : "analyzed",
                      "boost" : 1.0,
                      "term_vector" : "with_positions_offsets"

                      }}

}.

The documents I index are like this:
{"body" : "some data here", "my_anal" : "french-analyzer"}

where 'french-analyzer' is an anlyzer I defined in the settings

So! what is wrong wth my settings??


(Igor Motov) #2

I don't see anything particular wrong with your settings. Are you getting
an error? If not, why do you think that something is wrong? Can you make
sure that mappings are applied correctly by running

curl -XGET localhost:9200/your-index/_mapping

Are specifying proper analyzer for your search queries?

On Tuesday, April 10, 2012 10:24:49 AM UTC-4, lyes zaiko wrote:

Hi all!

I have read in the api documentation that we can set a specific analyzers
fir a document by setting the "_analyzer" property in the mapping like this:

{
"type1" : {
"_analyzer" : {
"path" : "my_field"
}
}
}

so if I set the analyzer I want to use a specific analyzer dor a document,
I have to set the value of "my_field" to its name.

I tried this for my cas, but it does not seem to work

so my mapping is :

{"content": {
"_source" : {"enabled" : true},
"_uid" : {"index" : "no", "store" : "no"},
"_id" : {"index" : "no", "store" : "yes"},
"_analyzer" : {"path" : "my_anal", "index" : "no"},
"_index" : {"enabled" : true, "index" : "no", "store" :
"yes"},
"properties" : {

"body" : {"type" : "string",
"store" : "yes",

                      "index" : "analyzed",
                      "boost" : 1.0,
                      "term_vector" : "with_positions_offsets"
          
                      }}

}.

The documents I index are like this:
{"body" : "some data here", "my_anal" : "french-analyzer"}

where 'french-analyzer' is an anlyzer I defined in the settings

So! what is wrong wth my settings??


(lyes zaiko) #3

Yes! the mapping is correctly applied. There is no error in the search but
it seems that the stemming is not well running. My analyzer is correctly
configured since when I set it statically, it works fine.

On Tue, Apr 10, 2012 at 9:16 PM, Igor Motov imotov@gmail.com wrote:

I don't see anything particular wrong with your settings. Are you getting
an error? If not, why do you think that something is wrong? Can you make
sure that mappings are applied correctly by running

curl -XGET localhost:9200/your-index/_mapping

Are specifying proper analyzer for your search queries?

On Tuesday, April 10, 2012 10:24:49 AM UTC-4, lyes zaiko wrote:

Hi all!

I have read in the api documentation that we can set a specific analyzers
fir a document by setting the "_analyzer" property in the mapping like this:

{
"type1" : {
"_analyzer" : {
"path" : "my_field"
}
}
}

so if I set the analyzer I want to use a specific analyzer dor a
document, I have to set the value of "my_field" to its name.

I tried this for my cas, but it does not seem to work

so my mapping is :

{"content": {
"_source" : {"enabled" : true},
"_uid" : {"index" : "no", "store" : "no"},
"_id" : {"index" : "no", "store" : "yes"},
"_analyzer" : {"path" : "my_anal", "index" : "no"},
"_index" : {"enabled" : true, "index" : "no", "store" :
"yes"},
"properties" : {

"body" : {"type" : "string",
"store" : "yes",

                      "index" : "analyzed",
                      "boost" : 1.0,
                      "term_vector" : "with_positions_offsets"

                      }}

}.

The documents I index are like this:
{"body" : "some data here", "my_anal" : "french-analyzer"}

where 'french-analyzer' is an anlyzer I defined in the settings

So! what is wrong wth my settings??


(Igor Motov) #4

Could you post a repro to clarify what you mean by "stemming is not well
running". Here is an example to get you
started: https://gist.github.com/2358376

On Wednesday, April 11, 2012 3:28:33 AM UTC-4, lyes zaiko wrote:

Yes! the mapping is correctly applied. There is no error in the search but
it seems that the stemming is not well running. My analyzer is correctly
configured since when I set it statically, it works fine.

On Tue, Apr 10, 2012 at 9:16 PM, Igor Motov imotov@gmail.com wrote:

I don't see anything particular wrong with your settings. Are you getting
an error? If not, why do you think that something is wrong? Can you make
sure that mappings are applied correctly by running

curl -XGET localhost:9200/your-index/_mapping

Are specifying proper analyzer for your search queries?

On Tuesday, April 10, 2012 10:24:49 AM UTC-4, lyes zaiko wrote:

Hi all!

I have read in the api documentation that we can set a specific
analyzers fir a document by setting the "_analyzer" property in the mapping
like this:

{
"type1" : {
"_analyzer" : {
"path" : "my_field"
}
}
}

so if I set the analyzer I want to use a specific analyzer dor a
document, I have to set the value of "my_field" to its name.

I tried this for my cas, but it does not seem to work

so my mapping is :

{"content": {
"_source" : {"enabled" : true},
"_uid" : {"index" : "no", "store" : "no"},
"_id" : {"index" : "no", "store" : "yes"},
"_analyzer" : {"path" : "my_anal", "index" : "no"},
"_index" : {"enabled" : true, "index" : "no", "store" :
"yes"},
"properties" : {

"body" : {"type" : "string",
"store" : "yes",

                      "index" : "analyzed",
                      "boost" : 1.0,
                      "term_vector" : "with_positions_offsets"
          
                      }}

}.

The documents I index are like this:
{"body" : "some data here", "my_anal" : "french-analyzer"}

where 'french-analyzer' is an anlyzer I defined in the settings

So! what is wrong wth my settings??


(system) #5