Get the App
SLTechnology News&Howtos  ›  Servers  › 

Sample code for Elasticsearch Mapping

Shulou Source: shulou.com Published: 2022-05-31 19:22:50 10月03日 Update

This article mainly introduces the sample code of Elasticsearch Mapping, which is very detailed and has a certain reference value. Friends who are interested must finish it!

Elasticsearch Mapping sample PUT my_index {/ / create my_index index "mappings": {"user": {/ / create type "_ all": {"enabled": false}, / / Disable the _ all meta field for the user mapping type "properties": {"title": {"type": "string"} "name": {"type": "string"}, "age": {"type": "integer"}}, "blogpost": {"properties": {"title": {"type": "string"}, "body": {"type": "string"} "user_id": {"type": "string", "index": "not_analyzed"}, "created": {"type": "date", "format": "strict_date_optional_time | | epoch_millis"}

Type: the data type of the field, such as string and date

A simple type like string, date, long, double, boolean or ip.

A type which supports the hierarchical nature of JSON such as object or nested.

Or a specialised type like geo_point, geo_shape, or completion.

Index: whether the field should be searched as full text (analyzed), or as an exact value (not_analyzed), or not searchable at all (no)

Analyzer: determines which parser is used in full-text fields when indexing and or searching.

The above is all the content of this article "sample Code of Elasticsearch Mapping". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Examples fields search code full text content articles indexes values interests analyzers names guys buddies data more knowledge types industries information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS Shulou Tech Info Xiaomi Linux