Open
Description
While accessing the records I am getting the following error...
$ response.records
NoMethodError:
undefined method `each_pair' for "{\"success\":true}":String
corresponding curl request in log gives another result
$ curl -X POST -H '[User-Agent: CS](x-elastic-client-meta: es=7.17.1,rb=3.0.2,t=7.17.1,fd=1.10.0,nh=0.1.1, User-Agent: elasticsearch-ruby/7.17.1 (RUBY_VERSION: 3.0.2; linux x86_64; Faraday v1.10.0),), Content-Type: application/json' 'http://localhost:9200/users-test/_search?pretty&format=json' -d '{"from":0,"size":10,"query":{"bool":{"filter":[{"term":{"role_group":3}},{"term":{"confirmed":true}},{"term":{"deleted":false}},{"term":{"enable":true}},{"term":{"hiring_organization_id":"932c204f-fbf9-5171-beb5-c59693977683"}},{"terms":{"primary_role":["site admin","org admin","basic"]}}],"must_not":[],"must":[],"boost":1,"should":[{"simple_query_string":{"query":"confirmed_admin_user_fixture","fields":["name^30","id^30","email^40","name.autocomplete^10","username.autocomplete^10","email.autocomplete^20","contact_no^40","hiring_organization^25","hiring_organization.keyword^25","hiring_organization.autocomplete^10","primary_role^20","username^30"]}}],"minimum_should_match":1}},"_source":["id"],"sort":[{"email.keyword":"desc"}]}'
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
on altering the headers a bit
curl -X POST -H 'x-elastic-client-meta: es=7.17.1,rb=3.0.2,t=7.17.1,fd=1.10.0,nh=0.1.1' -H 'User-Agent: elasticsearch-ruby/7.17.1 (RUBY_VERSION: 3.0.2; linux x86_64; Faraday v1.10.0)' -H 'Content-Type: application/json' 'http://localhost:9200/users-test/_search?pretty&format=json' -d '{"from":0,"size":10,"query":{"bool":{"filter":[{"term":{"role_group":3}},{"term":{"confirmed":true}},{"term":{"deleted":false}},{"term":{"enable":true}},{"term":{"hiring_organization_id":"932c204f-fbf9-5171-beb5-c59693977683"}},{"terms":{"primary_role":["site admin","org admin","basic"]}}],"must_not":[],"must":[],"boost":1,"should":[{"simple_query_string":{"query":"confirmed_admin_user_fixture","fields":["name^30","id^30","email^40","name.autocomplete^10","username.autocomplete^10","email.autocomplete^20","contact_no^40","hiring_organization^25","hiring_organization.keyword^25","hiring_organization.autocomplete^10","primary_role^20","username^30"]}}],"minimum_should_match":1}},"_source":["id"],"sort":[{"email.keyword":"desc"}]}'
{
"took" : 9,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "users-test",
"_id" : "81cfdb9d-af18-5229-ae6f-f67367211365",
"_score" : null,
"_source" : {
"id" : "81cfdb9d-af18-5229-ae6f-f67367211365"
},
"sort" : [
"[email protected]"
]
}
]
}
}
while If I index any record its working fine but not for search.
curl -X POST -H 'User-Agent: CS, Content-Type: application/json' 'http://localhost:9200/users-test/_bulk?pretty&format=json' -d '{"index":{"_id":"fea0a345-c22b-5a07-9efb-56811ed4b332"}}
{"id":"fea0a345-c22b-5a07-9efb-56811ed4b332","email":"[email protected]","emails":[],"username":"owner_user_fixture","name":"","company_name":"","hiring_organization":"MSP HO IV","categories":[],"industries":[],"positions":[],"skills":[],"data_access":"supervisor","teams":"","team_ids":[],"agency_id":"","status":"Active","role_group":3,"primary_role":"owner","confirmed":true,"deleted":false,"created_at":"2022-09-28T21:04:03.325Z","updated_at":"2022-09-28T21:04:03.325Z","deleted_at":null,"last_sign_in_at":null,"confirmed_at":"2022-09-27T21:04:03.000Z","current_sign_in_at":null,"enable":true,"contact_no":null,"restrict_access":false,"hiring_organization_id":"932c204f-fbf9-5171-beb5-c59693977683","created_by_id":null,"updated_by_id":null,"groups":[],"group_ids":[],"locked":false,"locked_at":null,"office_id":null,"country_obj_name":"","country_obj_abbr":"","state_obj_name":"","state_obj_abbr":"","postal_code":null}
......
# 2022-09-29T02:34:03+05:30 [200] (0.011s)
#
# {"took":7,"errors":false,"items":[{"index":{"_index":"users-test","_id":"fea0a345-c22b-5a07-9efb-56811ed4b332","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"701e50c7-955a-5919-a9d6-0f575bf395a0","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"4ebb091e-0006-58b8-96c7-3ec7bb4995ad","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"9b987a56-5d8d-5cdc-b1b7-43036537dd4f","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"5b9e730a-0ca9-580d-92e5-485c72ec6a32","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"3b255842-5350-5756-8bda-d42fa1588ee9","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":5,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"b26bf204-f415-5126-89b4-47bdb1dc3115","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":6,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"81cfdb9d-af18-5229-ae6f-f67367211365","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":7,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"98d877ec-d7e6-543c-a333-5ca0ad90395d","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":8,"_primary_term":1,"status":201}},{"index":{"_index":"users-test","_id":"70eb1fe7-7c11-5056-a4f5-f033c5c4d773","_version":1,"result":"created","_shards":{"total":1,"successful":1,"failed":0},"_seq_no":9,"_primary_term":1,"status":201}}]}