Elasticsearch mapping fields in python script gives error as "unsupported parameters"

Mapping configuration are as follows:

es_mapping = {
            'properties': {
                'university': {
                    'type': 'object',
                    'properties': {
                        'name': {'type': 'text'},
                    }
                },
                'first_name': {'type': 'text'},
                'last_name': {'type': 'text'},
                'age': {'type': 'short'},
                'year_in_school': {'type': 'text'},
                'name_complete': {
                    'type': 'completion',  # you have to make a method for completition for sure!
                    'analyzer': 'simple',
                    'payloads': True,  # note that we have to provide payload while updating
                    'preserve_separators': True,
                    'preserve_position_increments': True,
                    'max_input_length': 50,
                },
                "course_names": {
                    "type": "text", 
                },
            }

Using above mapping when script is getting executed it gives following error:
Error:
elasticsearch.exceptions.RequestError: TransportError(400, u'mapper_parsing_exception', u'Mapping definition for [name_complete] has unsupported parameters: [payloads : true]')

By commenting this mapping I tried to run script but it fails while loading data with the following error:
u'error': {u'caused_by': {u'reason': u'unknown field name [payload], must be one of [input, weight, contexts]', u'type': u'illegal_argument_exception'}, u'reason': u'failed to parse', u'type': u'mapper_parsing_exception'}

Hi,

a general tip with the forum: please enclose code snippets in "```" otherwise the snippet is very hard to read. I edited your question so it is properly formatted.

You define the name_complete field to be used with a completion suggester, however you are using an unsupported parameter payloads (see docs) so the fix is to remove that parameter.

Daniel

Got it, Thank you Daniel.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.