创建mapping:
PUT /test
{
"settings": {
"refresh_interval": "5s",
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"tokenizer": {
"comma": {
"type": "pattern",
"pattern": ","
}
},
"analyzer": {
"comma": {
"tokenizer": "comma"
}
}
}
},
"mapping": {
"test": {
"properties": {
"channel": {
"type": "text",
"analyzer": "comma",
"search_analyzer": "comma"
}
}
}
}
}
插入数据:
POST /test/test/1
{
"channel": "1001,1002,1003"
}
查询数据
POST /test/test/_search
{
"query": {
"match": {
"channel": "1001"
}
}
}
PUT /test
{
"settings": {
"refresh_interval": "5s",
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"tokenizer": {
"comma": {
"type": "pattern",
"pattern": ","
}
},
"analyzer": {
"comma": {
"tokenizer": "comma"
}
}
}
},
"mapping": {
"test": {
"properties": {
"channel": {
"type": "text",
"analyzer": "comma",
"search_analyzer": "comma"
}
}
}
}
}
插入数据:
POST /test/test/1
{
"channel": "1001,1002,1003"
}
查询数据
POST /test/test/_search
{
"query": {
"match": {
"channel": "1001"
}
}
}
0 个回复