aparo / pyes

Python connector for ElasticSearch - the pythonic way to use ElasticSearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NestedObject how to create mapping using dictionary

alexinm opened this issue · comments

Hi
on http://pyes.readthedocs.org/en/latest/manual/usage.html
there is an example of creating a mapping using dictionary and also using objects.
Using objects it's more complex with extra nested data. Is it possible to create nested mapping using
dictionary ?
Something like :

  mapping = {
     'text': {
         'boost': 1.0,
         'index': 'analyzed',
         'store': 'yes',
         'type': u'string',
         'analyzer': 'snowball',
         "term_vector": "with_positions_offsets"
     },

    'action_buttons': [
                            {
                                 'button_name': {
                                             'index': 'not_analyzed',
                                             'store': 'yes',
                                             'type': u'string',
                                         },
                                 'action_link': {
                                             'index': 'not_analyzed',
                                             'store': 'yes',
                                             'type': u'string',
                                         },
                                 'visible': {
                                             'index': 'not_analyzed',
                                             'store': 'yes',
                                             'type': u'boolean',
                                         },

                            },
    ],
    }

NVM
I found an example in test_aggs.py.
But it's good idea to update the doc