我想将MySQL查询转换为php中的弹性搜索
SELECT id,username,full_name
FROM users
WHERE id<>4 AND (username LIKE %john% OR full_name LIKE %full_name%)
LIMIT 50 OFFSET 0
请教育
答案 0 :(得分:1)
它是这样的:
GET /users/_search?pretty=true
{
"size": 50,
"query": {
"bool": {
"should": [
{
"terms": {
"username": "john"
}
},
{
"terms": {
"full_name": "full_name"
}
}
],
"must_not": [
{
"term": {
"id": "4"
}
}
]
}
}