Is it is possible to apply mapping on single fields?


(Sam-4) #1

Hi

I have following fields:

primaryfileID, jobID, AccountName, alternateIndustry, AddressLine1_1

I want "AccountName" field not analysed ,rest of remaining fields uses
analyzer setting,Is it is possible to apply mapping on single field,or need
to create mapping for rest of field with analyzed.

used mappings:

{
"primarytype" : {
"properties" : {
"AccountName" : {"type" : "string", "index" : "not_analyzed"},
}
}
}

please help me?

Thanks


(David Pilato) #2

You can define a mapping with one single field and let the "merge mapping" feature add new fields when the first document is indexed.

But IMHO, it's a bad practice.

My advice is :
Send a full document to ES
Get the automatic mapping for this type
Modify it (modify the field you need)
Delete the type
Create the type with the new mapping
Send your documents

HTH
David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 12 mai 2012 à 08:40, sam mishra.sameek@gmail.com a écrit :

Hi

I have following fields:

primaryfileID, jobID, AccountName, alternateIndustry, AddressLine1_1

I want "AccountName" field not analysed ,rest of remaining fields uses analyzer setting,Is it is possible to apply mapping on single field,or need to create mapping for rest of field with analyzed.

used mappings:

{
"primarytype" : {
"properties" : {
"AccountName" : {"type" : "string", "index" : "not_analyzed"},
}
}
}

please help me?

Thanks


(Shay Banon) #3

No problem with sending mappings just for a single field (or specific
fields), and relaying on the automatic schema for the rest.

On Sat, May 12, 2012 at 9:40 AM, sam mishra.sameek@gmail.com wrote:

Hi

I have following fields:

primaryfileID, jobID, AccountName, alternateIndustry, AddressLine1_1

I want "AccountName" field not analysed ,rest of remaining fields uses
analyzer setting,Is it is possible to apply mapping on single field,or need
to create mapping for rest of field with analyzed.

used mappings:

{

"primarytype" : {

    "properties" : {

        "AccountName" : {"type" : "string", "index" : "not_analyzed"},

                }

}

}

please help me?

Thanks


(system) #4