Objects in an application are seldom just a simple list of keys and values.
More often than not, they are complex data structures that may contain dates,
geo locations, other objects, or arrays of values.

Sooner or later you’re going to want to store these objects in a database.
Trying to do this with the rows and columns of a relational database is the
equivalent of trying to squeeze your rich, expressive objects into a very big
spreadsheet: you have to flatten the object to fit the table schema—usually
one field per column—and then have to reconstruct it every time you
retrieve it.

Elasticsearch is document oriented, meaning that it stores entire objects or
documents. It not only stores them, but also indexes the contents of
each document in order to make them searchable. In Elasticsearch, you index,
search, sort, and filter documents—not rows of columnar data. This is a
fundamentally different way of thinking about data and is one of the reasons
Elasticsearch can perform complex full-text search.

Elasticsearch uses JavaScript Object Notation, or JSON, as the serialization format for documents. JSON
serialization is supported by most programming languages, and has become the
standard format used by the NoSQL movement. It is simple, concise, and easy to
read.

Although the original user object was complex, the structure and meaning of
the object has been retained in the JSON version. Converting an object to JSON
for indexing in Elasticsearch is much simpler than the equivalent process for
a flat table structure.

Almost all languages have modules that will convert arbitrary data
structures or objects into JSON for you, but the details are specific to each
language. Look for modules that handle JSON serialization or marshalling. The official
Elasticsearch Clients all handle conversion to and from JSON for you
automatically.