pyes.mappings

class pyes.mappings.AbstractField(index=True, store=False, boost=1.0, term_vector=False, term_vector_positions=False, term_vector_offsets=False, omit_norms=True, tokenize=True, omit_term_freq_and_positions=True, type=None, index_name=None, index_options=None, path=None, norms=None, analyzer=None, index_analyzer=None, search_analyzer=None, name=None, locale=None, fields=None)
as_dict()
get_code(num=0)
class pyes.mappings.AttachmentField(name, type=None, path=None, fields=None)

An attachment field.

Requires the mapper-attachments plugin to be installed to be used.

as_dict()
class pyes.mappings.BinaryField(*args, **kwargs)
as_dict()
class pyes.mappings.BooleanField(null_value=None, include_in_all=None, *args, **kwargs)
as_dict()
class pyes.mappings.ByteField(*args, **kwargs)
class pyes.mappings.DateField(format=None, **kwargs)
as_dict()
to_es(value)
to_python(value)
class pyes.mappings.DocumentObjectField(_all=None, _boost=None, _id=None, _index=None, _source=None, _type=None, date_formats=None, _routing=None, _ttl=None, _parent=None, _timestamp=None, _analyzer=None, _size=None, date_detection=None, numeric_detection=None, dynamic_date_formats=None, _meta=None, *args, **kwargs)
add_property(prop)

Add a property to the object

as_dict()
enable_compression(threshold='5kb')
get_code(num=1)
get_meta(subtype=None)

Return the meta data.

save()
class pyes.mappings.DoubleField(*args, **kwargs)
class pyes.mappings.FloatField(*args, **kwargs)
class pyes.mappings.GeoPointField(null_value=None, include_in_all=None, lat_lon=None, geohash=None, geohash_precision=None, normalize_lon=None, normalize_lat=None, validate_lon=None, validate_lat=None, *args, **kwargs)
as_dict()
class pyes.mappings.IntegerField(*args, **kwargs)
class pyes.mappings.IpField(*args, **kwargs)
class pyes.mappings.LongField(*args, **kwargs)
class pyes.mappings.Mapper(data, connection=None, is_mapping=False, document_object_field=None)
get_all_indices()
get_doctype(index, name)

Returns a doctype given an index and a name

get_doctypes(index, edges=True)

Returns a list of doctypes given an index

get_property(index, doctype, name)

Returns a property of a given type

:return a mapped property

migrate(mapping, index, doc_type)

Migrate a ES mapping

Parameters:
  • mapping – new mapping
  • index – index of old mapping
  • doc_type – type of old mapping
Returns:

The diff mapping

class pyes.mappings.MultiField(name, type=None, path=None, fields=None)
add_fields(fields)
as_dict()
get_diff(other_mapping)

Returns a Multifield with diff fields. If not changes, returns None :param other_mapping: :return: a Multifield or None

class pyes.mappings.NestedObject(*args, **kwargs)
class pyes.mappings.NumericFieldAbstract(null_value=None, include_in_all=None, precision_step=4, numeric_resolution=None, ignore_malformed=None, **kwargs)
as_dict()
class pyes.mappings.ObjectField(name=None, type=None, path=None, properties=None, dynamic=None, enabled=None, include_in_all=None, dynamic_templates=None, include_in_parent=None, include_in_root=None, connection=None, index_name=None, *args, **kwargs)
add_property(prop)

Add a property to the object

as_dict()
clear_properties()

Helper function to reset properties

get_available_facets()

Returns Available facets for the document

get_code(num=1)
get_datetime_properties(recursive=True)

Returns a dict of property.path and property.

:param recursive the name of the property :returns a dict

get_diff(new_mapping)

Given two mapping it extracts a schema evolution mapping. Returns None if no evolutions are required :param new_mapping: the new mapping :return: a new evolution mapping or None

get_properties_by_type(type, recursive=True, parent_path='')

Returns a sorted list of fields that match the type.

:param type the type of the field “string”,”integer” or a list of types :param recursive recurse to sub object :returns a sorted list of fields the match the type

get_property_by_name(name)

Returns a mapped object.

:param name the name of the property :returns the mapped object or exception NotFoundMapping

save()
class pyes.mappings.ShortField(*args, **kwargs)
class pyes.mappings.StringField(null_value=None, include_in_all=None, *args, **kwargs)
as_dict()
pyes.mappings.get_field(name, data, default='object', document_object_field=None, is_document=False)

Return a valid Field by given data

pyes.mappings.to_bool(value)

Convert a value to boolean :param value: the value to convert :type value: any type :return: a boolean value :rtype: a boolean