+ All Categories
Home > Technology > Elasticsearch Meta Fields

Elasticsearch Meta Fields

Date post: 12-Apr-2017
Category:
Upload: bo-andersen
View: 25 times
Download: 0 times
Share this document with a friend
17
META FIELDS by Bo Andersen - codingexplained.com
Transcript
Page 1: Elasticsearch Meta Fields

META FIELDSby Bo Andersen - codingexplained.com

Page 2: Elasticsearch Meta Fields

OUTLINE➤ Introduction to meta fields➤ Meta fields categories

➤ Identity➤ Document source➤ Indexing➤ Routing➤ Other

Page 3: Elasticsearch Meta Fields

INTRODUCTION TO META FIELDS➤ Each document has metadata associated with it

➤ E.g. the _index, _type, and _id meta fields.➤ The behavior of some of these meta-fields can be customized

➤ This is done when creating a mapping type

Page 4: Elasticsearch Meta Fields

IDENTITY META FIELDS

Page 5: Elasticsearch Meta Fields

IDENTITY META FIELDS (PART 1)➤ _index

➤ Allows matching documents based on their indexes➤ _index is exposed as a virtual field and is not added to the Lucene index

as a real field

➤ _type

➤ The type of the document➤ Indexed in order to make searching by type name fast

Page 6: Elasticsearch Meta Fields

IDENTITY META FIELDS (PART 2)➤ _id

➤ The ID of the document➤ Not indexed, because its value can be automatically derived from the _uid field

➤ _uid

➤ The values of _type and _id are combined as {type}#{id} and indexed

Page 7: Elasticsearch Meta Fields

DOCUMENT SOURCE

META FIELDS

Page 8: Elasticsearch Meta Fields

DOCUMENT SOURCE META FIELDS➤ _source

➤ Contains the JSON that was passed at index time (unless updated)➤ The field is not indexed and is therefore not searchable➤ It is stored so that it can be returned when executing fetch requests➤ Can be disabled to save storage space

➤ _size

➤ Indexes the size of the _source field in bytes➤ Available as a plugin that must be installed before the field is available➤ sudo bin/plugin install mapper-size

Page 9: Elasticsearch Meta Fields

INDEXING META

FIELDS

Page 10: Elasticsearch Meta Fields

_ALL➤ A special field that concatenates the values of all of the other fields into

one string➤ Uses space as a delimiter➤ The field is analyzed and indexed, but not stored

➤ This means that it can be searched, but not retrieved➤ The field allows you to search for values in documents without knowing

which field contains the value

Page 11: Elasticsearch Meta Fields

_FIELD_NAMES➤ Indexes the names of every field in a document that contains a value other

than NULL➤ Used by the exists and missing queries

➤ To find documents that either have or do not have a non-null value for a particular field

Page 12: Elasticsearch Meta Fields

ROUTING META

FIELDS

Page 13: Elasticsearch Meta Fields

_PARENT➤ Can be used to establish a parent-child relationship between documents in

an index➤ This is done by making one mapping type the parent of another

"mappings": {

"employee": {

"_parent": {

"type": "person"

}

}

}

When adding an index:

Page 14: Elasticsearch Meta Fields

_ROUTING➤ Used to route a document to a particular shard within an index➤ Enables you to define rules that control in which shards documents are

stored➤ For advanced use cases!

Page 15: Elasticsearch Meta Fields

OTHER META

FIELDS

Page 16: Elasticsearch Meta Fields

_META➤ Each mapping type can have custom meta data associated with it➤ Elasticsearch does not use this meta data at all➤ Can be used to store application-specific meta data

➤ This can be anything you want

Page 17: Elasticsearch Meta Fields

THANK YOU FOR WATCHING!


Recommended