Вот так выглядят мои данные в расположении сервера:
{
"took":2,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"skipped":0,
"failed":0
},
"hits":{
"total":3,
"max_score":1.0,
"hits":[
{
"_index":"tagging2",
"_type":"_doc",
"_id":"0fJhM2kBfnQadvGUCy-v",
"_score":1.0,
"_source":{
"variable":[
"serloc_curr_div_nm",
"e_c_apmused_suv_imp_upper_0t5",
"e_c_apmused_car_imp_11plus",
"e_c_mosaic_2011_us",
"e_c_comb_homeowner_renter",
"serloc_curr_reg_nm",
"e_low_credit_seg",
"e_area_credit_s",
"e_c_dwelling_unit_size",
"e_bal_to_credit_amt"
],
"tags":"Demographics",
"numofvar":10
}
},
{
"_index":"tagging2",
"_type":"_doc",
"_id":"zvJgM2kBfnQadvGU5C-9",
"_score":1.0,
"_source":{
"variable":[
"acct_hardcopy_stment_ind",
"copyright_cost_amt",
"credit_card_cost_amt",
"tax_charge_amt",
"acct_electronic_bill_ind",
"all_ppv_mrm_amt",
"biller_cost_amt",
"cdv_cost_amt",
"vid_cost_amt",
"ttl_cost_amt",
"acct_payment_method_desc"
],
"tags":"Billing",
"numofvar":11
}
},
{
"_index":"tagging2",
"_type":"_doc",
"_id":"y_JgM2kBfnQadvGUvi8y",
"_score":1.0,
"_source":{
"variable":[
"tenure",
"ONBOARDING_SALES_CHANNEL_GROUP",
"svcs_hsd_days_on_books",
"currdayssince",
"custpenetrationrate",
"acct_comm_resi_cd",
"acct_complex_master_ind",
"segment_afn_flag"
],
"tags":"Account",
"numofvar":8
}
}
]
}
}
В Кибане я могу выполнить запрос GET:
GET /tagging/_doc/_search?size=10
{
"query": {"wildcard":{"variable" : "ten*"}}
}
, который преобразуется в команду curl ивыполняется успешно:
curl -XGET "http://location:9200/tagging/_doc/_search?size=10" -H 'Content-Type: application/json' -d'
{
"query": {"wildcard":{"variable" : "ten*"}}
}'
Теперь я пытаюсь получить данные с помощью упругого поиска с того же местоположения сервера, используя jQuery ajax:
function section_select() {
jQuery.ajax({
url: "http://location:9200/tagging/_doc/_search?size=10",
type: "GET",
data: {
"query": {
"wildcard": {
"variable": "ten*"
}
}
},
contentType: "application/JSON",
success: function (response) {
console.log(response);
}
});
}
Это не работает и выдает ошибку:
{
"error":{
"root_cause":[
{
"type":"illegal_argument_exception",
"reason":"request [/tagging/_doc/_search] contains unrecognized parameter: [query[wildcard][variable]]"
}
],
"type":"illegal_argument_exception",
"reason":"request [/tagging/_doc/_search] contains unrecognized parameter: [query[wildcard][variable]]"
},
"status":400
}
Запрос обрабатывается на:
http://location:9200/tagging/_doc/_search?size=10&query%5Bwildcard%5D%5Bvariable%5D=ten*