Define a dynamic not_analyzed field for a nested document


(朴元奎) #1

I have a document like below, the "tags" field is a nested document, and I
want to make all child field for tags document to be index = not_analyzed.
The problem is that field in tags will be dynamic. any tag could possible.
So how I can define dynamic mapping for this.

{
'level': 'info',
'tags': {
'content': 'Nov 6 11:07:10 ja10 Keepalived_healthcheckers: Adding
service [172.16.08.105:80] to VS [172.16.1.21:80]',
'id': 1755360087,
'kid': '2012121316',
'mailto': 'yanping3,chunying,pengjie',
'route': 15,
'service': 'LVS',
'subject': 'LVS_RS',
'upgrade': 'no upgrade configuration for this alert'
},
'timestamp': 1383707282.500464
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

You can define a dynamic template where the path is every field of your
nested type:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates

"dynamic_templates": [
{
"mytemplate": {
"path_match": "mynested.*",
"mapping": {
"index" : "not_analyzed"
}
}
}
]

Cheers,

Ivan

On Mon, Nov 11, 2013 at 7:50 PM, 朴元奎 piaoyuankui@gmail.com wrote:

I have a document like below, the "tags" field is a nested document, and I
want to make all child field for tags document to be index = not_analyzed.
The problem is that field in tags will be dynamic. any tag could possible.
So how I can define dynamic mapping for this.

{
'level': 'info',
'tags': {
'content': 'Nov 6 11:07:10 ja10 Keepalived_healthcheckers: Adding
service [172.16.08.105:80] to VS [172.16.1.21:80]',
'id': 1755360087,
'kid': '2012121316',
'mailto': 'yanping3,chunying,pengjie',
'route': 15,
'service': 'LVS',
'subject': 'LVS_RS',
'upgrade': 'no upgrade configuration for this alert'
},
'timestamp': 1383707282.500464
}

--
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.
For more options, visit https://groups.google.com/groups/opt_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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3