Я не могу получить хиты с сервера эластичного поиска.Мой код -
client = Elasticsearch::Client.new log: true
client.indices.refresh index: 'property_index'
# search_results = client.search(body: { query: { multi_match: { query: search_params, fields: ['street_address', 'suburb'] } } })
match_query = [
{ match: { status: 'Active'} }
]
match_query << { match: { is_published: true} }
match_query << { match: { paid: true} }
match_query << { match: { suburb: params[:suburb].to_s} } if !params[:suburb].blank?
match_query << { match: { advertise_type: params[:advertise_type].to_s} } if !params[:advertise_type].blank?
match_query << { match: { state: params[:state].to_s} } if !params[:state].blank?
match_query << { match: { postal_code: params[:postal_code]} } if !params[:postal_code].blank?
response = client.search(body: {
query: { bool: { must: match_query }},
sort: [
{ updated_at: { order: "desc" }}
]
}, from: params[:offset], size: params[:limit])
all_records = client.search(body: {
query: { bool: { must: match_query }},
sort: [
{ updated_at: { order: "desc" }}
]
})
Это вывод ответа, который я получаю -
GET http://localhost:9200/_search?from=0&size=10 [status:200, request:0.010s, query:0.003s]
2018-11-20 18:25:34 +0530:> {"query":{ "BOOL": { "сусло": [{ "матч": { "статус": "Активный"}}, { "матч": { "is_published": истинно}}, { "матч": { "оплачено": true}}, {"match": {"advertise_type": "Sell"}}]}}, "sort": [{"updated_at": {"order": "desc"}}]} 2018-11-20 18:25:34 +0530: <{"взял": 3, "timed_out": ложно, "_ осколки": {"всего": 1, "успешно": 1, "не удалось": 0}, "хиты": {"total": 0, "max_score": null, "hit": []}} 2018-11-20 18:25:34 +0530: GET <a href="http://localhost:9200/_search" rel="nofollow noreferrer">http://localhost:9200/_search [статус: 200, запрос: 0,008s, query: 0.002s] 2018-11-20 18:25:34 +0530:> {"query": {"bool": {"must": [{"match": {"status": "Active"}}, { "матч": { "is_published": истинно}}, { "матч": { "оплачено": истинный}}, { "матч": { "advertise_type": "Sell"}}]}},"sort": [{"updated_at": {"order": "desc"}}]} 2018-11-20 18:25:34 +0530: <{"take": 2, "timed_out": false, "_shards ": {" всего ": 1," успешно ": 1," не ": 0}," хиты ": {" TOTAL ": 0," max_score ": нулевой," хиты ": []}} </p>