Document

In the Elasticsearch world (that is, in Lucene world), a document is the main entity and basic unit of user data.

As mentioned earlier, the document format is JSON. Documents consist of fields (that is, properties) and value pairs. Each field has a name and a type supporting existing data types. A field is stored physically in a type within an index as an element of a document that has a unique ID.

Now, let's send a document to Elasticsearch:

curl -XPOST localhost:9200/premierleague/topscorer -d '{
  "fullname": "Robin van Persie",
  "age": 32,
  "birthdate": "1983-08-06",
"current_club": "Fenerbahce SK"
}'
{"_index":"premierleague","_type":"topscorer","_id":"AU8I47O90qdql2fUT1Oh","_version":1,"created":true}

As seen, we indexed the document without ...

Get Elasticsearch Indexing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.