PUT test_search_index
{
"settings": {
"number_of_shards": 1
}
}
POST test_search_index/doc/_bulk
{"index":{"_id":"1"}}
{"username":"alfred way","job":"java engineer","age":18,"birth":"1992-01-02","isMarried":false}
{"index":{"_id":"2"}}
{"username":"alfred","job":"java senior engineer and java specialist","age":28,"birth":"1980-05-07","isMarried":true}
{"index":{"_id":"3"}}
{"username":"lee","job":"java and ruby engineer","age":22,"birth":"1985-08-07","isMarried":false}
{"index":{"_id":"4"}}
{"username":"alfred junior way","job":"ruby engineer","age":23,"birth":"1989-08-07","isMarried":false}
GET test_search_index/_search?q=alfred
GET test_search_index/_search?q=alfred
{
"profile": "true"
}
GET test_search_index/_search?q=username:alfred
GET test_search_index/_search?q=username:alfred way
GET test_search_index/_search?q=username:"alfred way"
GET test_search_index/_search?q=username:(alfred way)
GET test_search_index/_search?q=username:alfred AND way
GET test_search_index/_search?q=username:(alfred AND way)
GET test_search_index/_search?q=username:(alfred NOT way)
# url上+号会被解析成空格,改成%2B
GET test_search_index/_search?q=username:(alfred %2Bway)
GET test_search_index/_search?q=username:alfred age:>20
GET test_search_index/_search?q=username:alfred AND age:>20
GET test_search_index/_search?q=birth:(>1980 AND <1990)
GET test_search_index/_search?q=username:/[a]?l.*/
GET test_search_index/_search?q=username:alfed
GET test_search_index/_search?q=username:alfed~1
GET test_search_index/_search?q=username:alfe~2
GET test_search_index/_search?q=job:"java engineer"
GET test_search_index/_search?q=job:"java engineer"~1
GET test_search_index/_search?q=job:"java engineer"~2
网友评论