mozilla / elasticutils

[deprecated] A friendly chainable ElasticSearch interface for python
http://elasticutils.rtfd.org
BSD 3-Clause "New" or "Revised" License
243 stars 76 forks source link

get_mapping never called #221

Open pziemkowski opened 10 years ago

pziemkowski commented 10 years ago

I'm writing a django app and would like to create some mappings using class extending Indexable and MappingType helpers. The problem is that get_mapping method is never called. I have checked the source code of those helpers and can't find any line that would lead to this call. Maybe I am doing something wrong?

Here's the definition of my get_mapping:

    @classmethod
    def get_mapping(cls):
        return {
            '_parent': {
                'type': 'user_type'
            },
            'properties': {
                'id': {'type': 'integer'},
                'item': {'type': 'integer'},
                'created': {'type': 'date'}
            }
        }
willkg commented 10 years ago

ElasticUtils doesn't (yet) have any code to create indexes. The get_mapping suggestion is there to give you some of the scaffolding you need to set up the code for creating an index with specified mappings.

johnraz commented 10 years ago

Just got caught by this... It would be nice to add something in the doc about it, not sure where to put it though. I would rather add it in the method's doc... Hint anyone ?

alexinm commented 10 years ago

Yeah, I spend too much time figuring out why my geo_point type is not created as such, basically right now it picks it up from ORM and not from mappings . Basically extract_document() in elasticutils.contrib.django.tasks.index_objects can only infer core types and not geo_point type for example