Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 918 Bytes

index.md

File metadata and controls

40 lines (31 loc) · 918 Bytes

Indexing

Indexing means adding a document to the search engine making it available for searching. All documents have an id and that can be specified by you or generated by elasticsearch.

Lets index a very simple document that has a single field, a name.

index into "family" -> "soprano" fields {
    "head" -> "tony"
}

Very SQL like as you can see. We can also specify the id.

index into "family" -> "soprano" fields {
    "boss" -> "tony"
} id 1234

The id can be any object, it will be converted to a string using toString(). Multiple fields? Easy.

index into "family" -> "soprano" fields (
    "boss" -> "tony",
    "consigliere" -> "salvidor",
    "underboss" -> "bobby"
) id 1234

If we have a nested structure, we can specifiy nested fields using dot notation.

index into "family" -> "soprano" fields (
    "boss" -> "tony",
    "boss.age" -> "56"
)