Default field setting under a dynamic 'object'


(Zsombor) #1

Hi,

Is it possible to define field mapping under a dynamic object for every
field? I don't know in advance the name of the fields, but all should have
been treated as string keywords. Imagine something similar for the mapping:

myCustomMapping {
"fieldA": { "type": "string", "index": "analyzed", "analyzer": "keyword",
"store":"yes" }
"fieldB": { "type": "string", "index": "analyzed", "analyzer": "keyword",
"store":"yes" }
"fieldC": { "type": "string", "index": "analyzed", "analyzer": "keyword",
"store":"yes" }
"customFields": {
"type": "object",
"dynamic": "true",

  •    "_defaultMapping" : {
              { "type": "string", "index": "analyzed", "analyzer": 
    

"keyword", "store":"yes" }
}

  • }
    }

I'm not sure, that my intentions are clear enough, I would like to search
by any of the customFields as terms.
Any suggestions how to achieve this, are welcomed.

Thanks
Zsombor


(Shay Banon) #2

You can do that using dynamic templates in the root object mapper.

On Wed, May 30, 2012 at 10:51 AM, Zsombor gzsombor@gmail.com wrote:

Hi,

Is it possible to define field mapping under a dynamic object for every
field? I don't know in advance the name of the fields, but all should have
been treated as string keywords. Imagine something similar for the mapping:

myCustomMapping {
"fieldA": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"fieldB": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"fieldC": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"customFields": {
"type": "object",
"dynamic": "true",

  •    "_defaultMapping" : {
              { "type": "string", "index": "analyzed", "analyzer":
    

"keyword", "store":"yes" }
}

  • }
    }

I'm not sure, that my intentions are clear enough, I would like to search
by any of the customFields as terms.
Any suggestions how to achieve this, are welcomed.

Thanks
Zsombor


(Zsombor) #3

Thanks, it works !

Regards
Zsombor

On Sunday, June 3, 2012 11:01:27 AM UTC+2, kimchy wrote:

You can do that using dynamic templates in the root object mapper.

On Wed, May 30, 2012 at 10:51 AM, Zsombor gzsombor@gmail.com wrote:

Hi,

Is it possible to define field mapping under a dynamic object for every
field? I don't know in advance the name of the fields, but all should have
been treated as string keywords. Imagine something similar for the mapping:

myCustomMapping {
"fieldA": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"fieldB": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"fieldC": { "type": "string", "index": "analyzed", "analyzer":
"keyword", "store":"yes" }
"customFields": {
"type": "object",
"dynamic": "true",

  •    "_defaultMapping" : {
              { "type": "string", "index": "analyzed", "analyzer": 
    

"keyword", "store":"yes" }
}

  • }
    }

I'm not sure, that my intentions are clear enough, I would like to search
by any of the customFields as terms.
Any suggestions how to achieve this, are welcomed.

Thanks
Zsombor


(system) #4