标准的restful接口
查看所有index, 等价于show tables;
GET _cat/indices
GET test_index
GET kibana_sample_data_logs?include_type_name=true&include_defaults=true
aliases
mappings
settings
DELETE test_index
DELETE test_index?ignore_unavailable=true ==> drop table xx if exists
P
{
"
}
U
m
T
a
p
k
p
}
"
}
i
i
,
s
b
n
"
}
e
"
}
a
g
_
t
i
n
s
d
"
}
t
n
"
"
"
a
"
o
p
i
d
n
a
n
_
c
r
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
"
}
n
e
u
u
u
s
:
"
o
@
,
a
,
b
,
c
,
e
,
e
,
g
,
h
,
i
,
i
,
m
,
m
,
m
,
p
,
r
,
r
,
r
,
t
,
t
,
u
,
u
g
x
m
t
m
a
p
t
"
"
g
"
"
}
y
"
l
"
v
"
}
x
"
"
}
e
"
}
o
"
"
}
n
"
"
}
p
"
a
"
}
e
"
e
"
"
}
h
"
e
"
e
"
"
}
e
"
"
}
a
"
"
}
i
"
r
"
"
}
t
"
s
"
b
o
b
m
{
:
e
i
t
p
e
t
f
t
t
i
t
e
p
t
t
f
o
p
s
t
f
d
t
f
"
t
c
p
m
t
s
t
f
p
t
f
t
q
t
f
s
t
f
g
t
f
m
t
l
t
f
c
t
"
e
_
e
p
r
m
y
a
n
y
i
"
}
e
y
e
y
n
r
"
}
e
y
i
"
}
"
r
"
}
"
}
"
}
"
}
t
y
i
"
}
e
y
i
"
}
y
h
r
"
}
"
}
o
y
s
y
i
"
}
m
y
e
y
u
y
i
"
}
p
y
i
"
}
s
y
i
"
}
e
y
"
y
i
"
}
_
y
:
r
e
r
l
{
t
e
p
t
t
p
e
k
s
p
n
p
t
o
d
n
p
e
k
o
c
,
d
,
s
,
s
"
p
e
k
x
p
e
k
:
p
i
o
o
,
r
r
p
a
p
e
k
e
p
r
p
e
p
e
k
o
p
e
k
"
p
e
k
s
p
p
e
k
t
p
:
_
x
_
e
i
s
e
h
"
e
l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UT kibana_sample_data_ecommerce2/_settings
{
"
}
i
n
"
"
d
a
n
e
u
u
x
t
m
"
o
b
:
_
e
e
r
{
x
_
p
o
a
f
n
_
d
r
_
e
r
p
e
l
p
i
l
c
i
a
c
s
a
"
s
:
"
:
"
2
"
"
0
-
1
"
,
}
直接 ==> 插入数据,
让他动态索引(dynamic mapping)得到mapping,在此基础上更改。
字段类型
Field data types#
Elasticsearch supports a number of different data types for the fields in a document:
Core data types#
string
text , keyword and wildcard
Numeric
long, integer, short, byte, double, float, half_float, scaled_float
Date
date
Date nanoseconds
date_nanos
Boolean
boolean
Binary
binary
Range
integer_range, float_range, long_range, double_range, date_range, ip_range
Complex data types#
Spatial data types#
Geo-point
geo_point for lat/lon points
Geo-shape
geo_shape for complex shapes like polygons
Point
point for arbitrary cartesian points.
Shape
shape for arbitrary cartesian geometries.
Specialised data types#
IP
ip for IPv4 and IPv6 addresses
Completion data type
completion to provide auto-complete suggestions
Token count
token_count to count the number of tokens in a string
mapper-murmur3
murmur3 to compute hashes of values at index-time and store them in the index
mapper-annotated-text
annotated-text to index text containing special markup (typically used for identifying named entities)
Percolator
Accepts queries from the query-dsl
Join
Defines parent/child relation for documents within the same index
Rank feature
Record numeric feature to boost hits at query time.
Rank features
Record numeric features to boost hits at query time.
Dense vector
Record dense vectors of float values.
Sparse vector
Record sparse vectors of float values.
Search-as-you-type
A text-like field optimized for queries to implement as-you-type completion
Alias
Defines an alias to an existing field.
Flattened
Allows an entire JSON object to be indexed as a single field.
Histogram
histogram for pre-aggregated numerical values for percentiles aggregations.
Constant keyword
Specialization of keyword for the case when all documents have the same value.
Arrays#
In Elasticsearch, arrays do not require a dedicated field data type. Any field can contain zero or more values by default, however, all values in the array must be of the same data type. See Arrays .
Multi-fields#
It is often useful to index the same field in different ways for different purposes. For instance, a string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations. Alternatively, you could index a text field with the standard analyzer , the english analyzer, and the french analyzer .
This is the purpose of multi-fields . Most data types support multi-fields via the fields parameter.
“dynamic” : “true” | “false” | “strict”
“copy_to”
数组
多字段特性
简单提下, 下下次专门讲这块
Analysis | Built-in analyzer#
char filter
Tokenizer [必须有一个]
token filter
h
m
p
t
a
a
m
p
t
l
p
t
_
i
e
s
n
r
t
g
n
r
_
i
r
p
e
p
l
a
c
e
P
{
}
U
T
"
}
s
m
e
"
}
y
t
a
-
t
n
"
}
i
i
a
a
n
n
l
n
"
}
d
g
y
a
m
e
s
s
l
y
"
"
"
]
"
]
x
"
i
y
_
t
t
c
,
f
-
:
s
z
c
y
o
h
"
i
"
"
0
"
e
u
p
k
a
h
l
l
a
0
{
:
r
s
e
e
r
t
t
o
s
0
"
t
"
n
_
m
e
w
c
0
{
:
o
:
i
f
l
r
e
i
0
m
z
i
_
"
r
i
1
{
_
"
e
l
s
:
c
f
a
c
r
t
t
a
o
n
u
"
e
r
[
s
l
a
s
:
r
i
e
d
l
t
"
p
"
i
y
o
"
:
"
,
n
z
m
s
g
e
"
t
[
"
r
,
a
"
n
:
d
a
{
r
d
"
,
下一篇
### Python资源大全
微信公众号「福清而不淡」
后端架构 · AI 工程 · 云原生的一线实践,扫码关注,不错过更新。
本文已同步发布到公众号,欢迎留言交流。