'Defines an ``IndexField``, either replacing an existing
definition or creating a new one.
:type field_name: string
:param field_name: The name of a field in the search index.
:type field_type: string
:param field_type: The type of field.  Valid values are
int | double | literal | text | date | latlon |
int-array | double-array | literal-array | text-array | date-array
:type default: string or int
:param default: The default value for the field.  If the
field is of type ``int`` this should be an integer value.
Otherwise, it\'s a string.
:type facet: bool
:param facet: A boolean to indicate whether facets
are enabled for this field or not.  Does not apply to
fields of type ``int, int-array, text, text-array``.
:type returnable: bool
:param returnable: A boolean to indicate whether values
of this field can be returned in search results or
used in ranking.
:type searchable: bool
:param searchable: A boolean to indicate whether search
is enabled for this field or not.
:type sortable: bool
:param sortable: A boolean to indicate whether sorting
is enabled for this field or not. Does not apply to
fields of array types.
:type highlight: bool
:param highlight: A boolean to indicate whether highlighting
is enabled for this field or not. Does not apply to
fields of type ``double, int, date, latlon``
:type source_field: list of strings or string
:param source_field: For array types, this is the list of fields
to treat as the source. For singular types, pass a string only.
:type analysis_scheme: string
:param analysis_scheme: The analysis scheme to use for this field.
Only applies to ``text | text-array`` field types
:return: IndexFieldStatus objects
:rtype: :class:`boto.cloudsearch2.option.IndexFieldStatus` object
:raises: BaseException, InternalException, LimitExceededException,
InvalidTypeException, ResourceNotFoundException'

def create_index_field(self, field_name, field_type, default='', facet=False, returnable=False, searchable=False, sortable=False, highlight=False, source_field=None, analysis_scheme=None):

    index = {'IndexFieldName': field_name, 'IndexFieldType': field_type}
    if (field_type == 'literal'):
        index['LiteralOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable, 'SortEnabled': sortable}
        if default:
            index['LiteralOptions']['DefaultValue'] = default
        if source_field:
            index['LiteralOptions']['SourceField'] = source_field
    elif (field_type == 'literal-array'):
        index['LiteralArrayOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable}
        if default:
            index['LiteralArrayOptions']['DefaultValue'] = default
        if source_field:
            index['LiteralArrayOptions']['SourceFields'] = ','.join(source_field)
    elif (field_type == 'int'):
        index['IntOptions'] = {'DefaultValue': default, 'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable, 'SortEnabled': sortable}
        if default:
            index['IntOptions']['DefaultValue'] = default
        if source_field:
            index['IntOptions']['SourceField'] = source_field
    elif (field_type == 'int-array'):
        index['IntArrayOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable}
        if default:
            index['IntArrayOptions']['DefaultValue'] = default
        if source_field:
            index['IntArrayOptions']['SourceFields'] = ','.join(source_field)
    elif (field_type == 'date'):
        index['DateOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable, 'SortEnabled': sortable}
        if default:
            index['DateOptions']['DefaultValue'] = default
        if source_field:
            index['DateOptions']['SourceField'] = source_field
    elif (field_type == 'date-array'):
        index['DateArrayOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable}
        if default:
            index['DateArrayOptions']['DefaultValue'] = default
        if source_field:
            index['DateArrayOptions']['SourceFields'] = ','.join(source_field)
    elif (field_type == 'double'):
        index['DoubleOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable, 'SortEnabled': sortable}
        if default:
            index['DoubleOptions']['DefaultValue'] = default
        if source_field:
            index['DoubleOptions']['SourceField'] = source_field
    elif (field_type == 'double-array'):
        index['DoubleArrayOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable}
        if default:
            index['DoubleArrayOptions']['DefaultValue'] = default
        if source_field:
            index['DoubleArrayOptions']['SourceFields'] = ','.join(source_field)
    elif (field_type == 'text'):
        index['TextOptions'] = {'ReturnEnabled': returnable, 'HighlightEnabled': highlight, 'SortEnabled': sortable}
        if default:
            index['TextOptions']['DefaultValue'] = default
        if source_field:
            index['TextOptions']['SourceField'] = source_field
        if analysis_scheme:
            index['TextOptions']['AnalysisScheme'] = analysis_scheme
    elif (field_type == 'text-array'):
        index['TextArrayOptions'] = {'ReturnEnabled': returnable, 'HighlightEnabled': highlight}
        if default:
            index['TextArrayOptions']['DefaultValue'] = default
        if source_field:
            index['TextArrayOptions']['SourceFields'] = ','.join(source_field)
        if analysis_scheme:
            index['TextArrayOptions']['AnalysisScheme'] = analysis_scheme
    elif (field_type == 'latlon'):
        index['LatLonOptions'] = {'FacetEnabled': facet, 'ReturnEnabled': returnable, 'SearchEnabled': searchable, 'SortEnabled': sortable}
        if default:
            index['LatLonOptions']['DefaultValue'] = default
        if source_field:
            index['LatLonOptions']['SourceField'] = source_field
    data = self.layer1.define_index_field(self.name, index)
    data = data['DefineIndexFieldResponse']['DefineIndexFieldResult']['IndexField']
    return IndexFieldStatus(self, data, self.layer1.describe_index_fields)
