New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search method returns NULL #116
Comments
Bizarre...this looks like buggy behavior somehow (although I can't think of a reason yet). Your query looks fine, the trace logs look fine...there must be something about the output that is causing the JSON result parsing to choke in a non-fatal way. I'll break out the debugger and take a look with your version of ES and the client. |
Thank you, Zachary! If there's any testing I can do on my end, please don't be shy about letting me know. |
FYI, I peeked at this a little, but haven't had a chance to dig into it much (I'm in SF giving a training right now). I'll be home on Thursday, and will either have a go at this on the flight home, or as soon as I get back. :) |
Well...I haven't been able to reproduce this yet. I'm trying to reproduce on Elasticsearch 0.90.9 + Elasticsearch-php 1.2.0, and loaded the documents that were returned in the debug log. Everything seems to parse and return correctly. I'm a bit stumped at the moment.
|
No further errors are provided by dialing up PHP's verbosity, and narrowing the results against just one type (I tried several) doesn't make any difference. This would seem to point in the direction of me doing something dumb. :) Here's my mapping file: {
"finance": {
"1": {
"properties": {
"table-code": {
"type": "string"
},
"table-desc": {
"type": "string"
},
"table-identifier": {
"type": "string"
}
}
},
"2": {
"properties": {
"address-date": {
"type": "string"
},
"address_date": {
"type": "string"
},
"agent-city": {
"type": "string"
},
"agent-court-locality": {
"type": "string"
},
"agent-date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent-name": {
"type": "string"
},
"agent-state": {
"type": "string"
},
"agent-status": {
"type": "string"
},
"agent-street-1": {
"type": "string"
},
"agent-street-2": {
"type": "string"
},
"agent-zip": {
"type": "string"
},
"agent_city": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_name": {
"type": "string"
},
"agent_state": {
"type": "string"
},
"agent_status": {
"type": "string"
},
"agent_street_1": {
"type": "string"
},
"agent_street_2": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"assessment": {
"type": "string"
},
"city": {
"type": "string"
},
"corp-asmt-ind": {
"type": "string"
},
"corp-city": {
"type": "string"
},
"corp-id": {
"type": "string"
},
"corp-inc-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ind-code": {
"type": "string"
},
"corp-merger-ind": {
"type": "string"
},
"corp-name": {
"type": "string"
},
"corp-per-dur": {
"type": "string"
},
"corp-po-eff-date": {
"type": "string"
},
"corp-ra-city": {
"type": "string"
},
"corp-ra-eff-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ra-loc": {
"type": "string"
},
"corp-ra-name": {
"type": "string"
},
"corp-ra-state": {
"type": "string"
},
"corp-ra-status": {
"type": "string"
},
"corp-ra-street1": {
"type": "string"
},
"corp-ra-street2": {
"type": "string"
},
"corp-ra-zip": {
"type": "string"
},
"corp-state": {
"type": "string"
},
"corp-state-inc": {
"type": "string"
},
"corp-status": {
"type": "string"
},
"corp-status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-stock-class": {
"type": "string"
},
"corp-stock-ind": {
"type": "string"
},
"corp-stock-share-auth": {
"type": "string"
},
"corp-street1": {
"type": "string"
},
"corp-street2": {
"type": "string"
},
"corp-total-shares": {
"type": "string"
},
"corp-zip": {
"type": "string"
},
"expiration-date": {
"type": "date",
"format": "dateOptionalTime"
},
"expiration_date": {
"type": "string"
},
"id": {
"type": "string"
},
"incorporation-date": {
"type": "date",
"format": "dateOptionalTime"
},
"incorporation_date": {
"type": "date",
"format": "dateOptionalTime"
},
"industry": {
"type": "string"
},
"merged": {
"type": "string"
},
"name": {
"type": "string"
},
"number-shares": {
"type": "string"
},
"number_shares": {
"type": "string"
},
"state": {
"type": "string"
},
"state-formed": {
"type": "string"
},
"state_formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"status_date": {
"type": "date",
"format": "dateOptionalTime"
},
"stock-class": {
"type": "string"
},
"stock-ind": {
"type": "string"
},
"stock_class": {
"type": "string"
},
"stock_ind": {
"type": "string"
},
"street-1": {
"type": "string"
},
"street-2": {
"type": "string"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"total-shares": {
"type": "string"
},
"total_shares": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"3": {
"properties": {
"address_date": {
"type": "string"
},
"agent_city": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_name": {
"type": "string"
},
"agent_state": {
"type": "string"
},
"agent_status": {
"type": "string"
},
"agent_street_1": {
"type": "string"
},
"agent_street_2": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"city": {
"type": "string"
},
"corp-city": {
"type": "string"
},
"corp-formed": {
"type": "string"
},
"corp-id": {
"type": "string"
},
"corp-inc-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ind-code": {
"type": "string"
},
"corp-name": {
"type": "string"
},
"corp-per-dur": {
"type": "string"
},
"corp-po-eff-date": {
"type": "string"
},
"corp-ra-ZIP": {
"type": "string"
},
"corp-ra-city": {
"type": "string"
},
"corp-ra-eff-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ra-loc": {
"type": "string"
},
"corp-ra-name": {
"type": "string"
},
"corp-ra-state": {
"type": "string"
},
"corp-ra-status": {
"type": "string"
},
"corp-ra-street1": {
"type": "string"
},
"corp-ra-street2": {
"type": "string"
},
"corp-state": {
"type": "string"
},
"corp-state-inc": {
"type": "string"
},
"corp-status": {
"type": "string"
},
"corp-status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-street1": {
"type": "string"
},
"corp-street2": {
"type": "string"
},
"corp-zip": {
"type": "string"
},
"domestic": {
"type": "string"
},
"expiration_date": {
"type": "string"
},
"id": {
"type": "string"
},
"incorporation_date": {
"type": "date",
"format": "dateOptionalTime"
},
"industry": {
"type": "string"
},
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"state_formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status_date": {
"type": "date",
"format": "dateOptionalTime"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"4": {
"properties": {
"amended": {
"type": "string"
},
"amendment_type": {
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"hist-amend-date": {
"type": "string"
},
"hist-amend-ind": {
"type": "string"
},
"hist-amend-type": {
"type": "string"
},
"hist-corp-id": {
"type": "string"
},
"hist-old-shares-auth": {
"type": "string"
},
"hist-old-stock-class": {
"type": "string"
},
"hist-stock-info": {
"type": "string"
},
"id": {
"type": "string"
},
"shares_auth": {
"type": "string"
},
"stock_class": {
"type": "string"
},
"stock_info": {
"type": "string"
}
}
},
"5": {
"properties": {
"dirc-corp-id": {
"type": "string"
},
"dirc-first-name": {
"type": "string"
},
"dirc-last-name": {
"type": "string"
},
"dirc-middle-name": {
"type": "string"
},
"dirc-title": {
"type": "string"
},
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_name": {
"type": "string"
},
"middle_name": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"6": {
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"name-corp-id": {
"type": "string"
},
"name-corp-name": {
"type": "string"
},
"name-eff-date": {
"type": "date",
"format": "dateOptionalTime"
},
"name-status": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"7": {
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"merg-corp-id": {
"type": "string"
},
"merg-eff-date": {
"type": "date",
"format": "dateOptionalTime"
},
"merg-for-corp-name": {
"type": "string"
},
"merg-surv-id": {
"type": "string"
},
"merg-surv-qualified": {
"type": "string"
},
"merg-type": {
"type": "string"
},
"survivor_id": {
"type": "string"
},
"survivor_qualified": {
"type": "string"
},
"type": {
"type": "string"
},
"unqualified_name": {
"type": "string"
}
}
},
"8": {
"properties": {
"city": {
"type": "string"
},
"date_expires": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"requestor": {
"type": "string"
},
"state": {
"type": "string"
},
"status": {
"type": "string"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"type": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"9": {
"properties": {
"address-date": {
"type": "string"
},
"agent-city": {
"type": "string"
},
"agent-name": {
"type": "string"
},
"agent-state": {
"type": "string"
},
"agent-street-1": {
"type": "string"
},
"agent-street-2": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_status": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"city": {
"type": "string"
},
"corp-city": {
"type": "string"
},
"corp-id": {
"type": "string"
},
"corp-inc-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ind-code": {
"type": "string"
},
"corp-name": {
"type": "string"
},
"corp-per-dur": {
"type": "string"
},
"corp-po-eff-date": {
"type": "string"
},
"corp-ra-city": {
"type": "string"
},
"corp-ra-eff-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-ra-loc": {
"type": "string"
},
"corp-ra-name": {
"type": "string"
},
"corp-ra-state": {
"type": "string"
},
"corp-ra-status": {
"type": "string"
},
"corp-ra-street1": {
"type": "string"
},
"corp-ra-street2": {
"type": "string"
},
"corp-ra-zip": {
"type": "string"
},
"corp-state": {
"type": "string"
},
"corp-state-inc": {
"type": "string"
},
"corp-status": {
"type": "string"
},
"corp-status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"corp-street1": {
"type": "string"
},
"corp-street2": {
"type": "string"
},
"corp-zip": {
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"expiration-date": {
"type": "string"
},
"id": {
"type": "string"
},
"industry": {
"type": "string"
},
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"state-formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"street-1": {
"type": "string"
},
"street-2": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"lp": {
"properties": {
"corp-asmt-ind": {
"type": "string"
},
"corp-city": {
"type": "string"
},
"corp-id": {
"type": "string"
},
"corp-inc-date": {
"type": "string"
},
"corp-ind-code": {
"type": "string"
},
"corp-merger-ind": {
"type": "string"
},
"corp-name": {
"type": "string"
},
"corp-per-dur": {
"type": "string"
},
"corp-po-eff-date": {
"type": "string"
},
"corp-ra-city": {
"type": "string"
},
"corp-ra-eff-date": {
"type": "string"
},
"corp-ra-loc": {
"type": "string"
},
"corp-ra-name": {
"type": "string"
},
"corp-ra-state": {
"type": "string"
},
"corp-ra-status": {
"type": "string"
},
"corp-ra-street1": {
"type": "string"
},
"corp-ra-street2": {
"type": "string"
},
"corp-ra-zip": {
"type": "string"
},
"corp-state": {
"type": "string"
},
"corp-state-inc": {
"type": "string"
},
"corp-status": {
"type": "string"
},
"corp-status-date": {
"type": "string"
},
"corp-stock-class": {
"type": "string"
},
"corp-stock-ind": {
"type": "string"
},
"corp-stock-share-auth": {
"type": "string"
},
"corp-street1": {
"type": "string"
},
"corp-street2": {
"type": "string"
},
"corp-total-shares": {
"type": "string"
},
"corp-zip": {
"type": "string"
}
}
}
},
"richmondsunlight": {
"finance": {
"properties": {
"@attributes": {
"properties": {
"IsIndividual": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
},
"Address": {
"properties": {
"City": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Line2": {
"type": "string"
},
"State": {
"type": "string"
},
"ZipCode": {
"type": "string"
}
}
},
"Amount": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"AuthorizingName": {
"type": "string"
},
"CandidateName": {
"type": "string"
},
"CommitteeCode": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"CommitteeName": {
"type": "string"
},
"Contributor": {
"properties": {
"@attributes": {
"properties": {
"IsIndividual": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
},
"Address": {
"properties": {
"City": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Line2": {
"type": "string"
},
"State": {
"type": "string"
},
"ZipCode": {
"type": "string"
}
}
},
"FirstName": {
"type": "string"
},
"LastName": {
"type": "string"
},
"MiddleName": {
"type": "string"
},
"NameOfEmployer": {
"type": "string"
},
"OccupationOrTypeOfBusiness": {
"type": "string"
},
"Prefix": {
"type": "string"
},
"PrimaryCityAndStateOfEmploymentOrBusiness": {
"type": "string"
},
"Suffix": {
"type": "string"
}
}
},
"FirstName": {
"type": "string"
},
"ItemOrService": {
"type": "string"
},
"LastName": {
"type": "string"
},
"MiddleName": {
"type": "string"
},
"Payee": {
"properties": {
"@attributes": {
"properties": {
"IsIndividual": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
},
"Address": {
"properties": {
"City": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Line2": {
"type": "string"
},
"State": {
"type": "string"
},
"ZipCode": {
"type": "string"
}
}
},
"FirstName": {
"type": "string"
},
"LastName": {
"type": "string"
},
"MiddleName": {
"type": "string"
},
"Prefix": {
"type": "string"
},
"Suffix": {
"type": "string"
}
}
},
"Prefix": {
"type": "string"
},
"ReportId": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"Suffix": {
"type": "string"
},
"TotalToDate": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"TransactionDate": {
"type": "date",
"format": "dateOptionalTime"
},
"type": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
}
},
"business": {
"1": {
"properties": {
"table-code": {
"type": "string"
},
"table-desc": {
"type": "string"
},
"table-identifier": {
"type": "string"
}
}
},
"2": {
"properties": {
"address_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_city": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_name": {
"type": "string"
},
"agent_state": {
"type": "string"
},
"agent_status": {
"type": "string"
},
"agent_street_1": {
"type": "string"
},
"agent_street_2": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"assessment": {
"type": "string"
},
"city": {
"type": "string"
},
"expiration_date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"incorporation_date": {
"type": "date",
"format": "dateOptionalTime"
},
"industry": {
"type": "string"
},
"merged": {
"type": "string"
},
"name": {
"type": "string"
},
"number_shares": {
"type": "string"
},
"state": {
"type": "string"
},
"state_formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status_date": {
"type": "date",
"format": "dateOptionalTime"
},
"stock_class": {
"type": "string"
},
"stock_ind": {
"type": "string"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"total_shares": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"3": {
"properties": {
"agent_city": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_name": {
"type": "string"
},
"agent_state": {
"type": "string"
},
"agent_status": {
"type": "string"
},
"agent_street_1": {
"type": "string"
},
"agent_street_2": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"city": {
"type": "string"
},
"domestic": {
"type": "string"
},
"expiration_date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"incorporation_date": {
"type": "date",
"format": "dateOptionalTime"
},
"industry": {
"type": "string"
},
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"state_formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status_date": {
"type": "date",
"format": "dateOptionalTime"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"4": {
"properties": {
"amended": {
"type": "string"
},
"amendment_type": {
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"shares_auth": {
"type": "string"
},
"stock_class": {
"type": "string"
},
"stock_info": {
"type": "string"
}
}
},
"5": {
"properties": {
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_name": {
"type": "string"
},
"middle_name": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"6": {
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"7": {
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"survivor_id": {
"type": "string"
},
"survivor_qualified": {
"type": "string"
},
"type": {
"type": "string"
},
"unqualified_name": {
"type": "string"
}
}
},
"8": {
"properties": {
"city": {
"type": "string"
},
"date_expires": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"requestor": {
"type": "string"
},
"state": {
"type": "string"
},
"status": {
"type": "string"
},
"street_1": {
"type": "string"
},
"street_2": {
"type": "string"
},
"type": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
"9": {
"properties": {
"address-date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent-city": {
"type": "string"
},
"agent-name": {
"type": "string"
},
"agent-state": {
"type": "string"
},
"agent-street-1": {
"type": "string"
},
"agent-street-2": {
"type": "string"
},
"agent_court_locality": {
"type": "string"
},
"agent_date": {
"type": "date",
"format": "dateOptionalTime"
},
"agent_status": {
"type": "string"
},
"agent_zip": {
"type": "string"
},
"city": {
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"expiration-date": {
"type": "string"
},
"id": {
"type": "string"
},
"industry": {
"type": "string"
},
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"state-formed": {
"type": "string"
},
"status": {
"type": "string"
},
"status-date": {
"type": "date",
"format": "dateOptionalTime"
},
"street-1": {
"type": "string"
},
"street-2": {
"type": "string"
},
"zip": {
"type": "string"
}
}
}
}
} And here are my settings: {
"finance": {
"settings": {
"index.number_of_replicas": "1",
"index.version.created": "900999",
"index.number_of_shards": "5",
"index.uuid": "xMd_9DxRTuSxU8Pp4lOmOw"
}
},
"richmondsunlight": {
"settings": {
"index.version.created": "900999",
"index.number_of_replicas": "1",
"index.uuid": "TgxWfglFRLu0UCw5l9bOlQ",
"index.number_of_shards": "5"
}
},
"business": {
"settings": {
"index.number_of_replicas": "1",
"index.version.created": "900999",
"index.number_of_shards": "5",
"index.uuid": "FASi4Hx1RIKNiPnjnm_E2A"
}
}
} I'm generating the mapping dynamically in Python from YAML files. The JSON is valid, it looks fine to me, and Elasticsearch doesn't complain about it at all when indexing the data, but it's certainly possible that I'm doing something that elasticsearch-php isn't expecting. Is anything useful to be found there, or does everything look A-OK? |
FWIW, I've tried emptying out all indices and loading just a small subset of the data (anywhere from 220 KB to 30 MB; the total dataset is about 1 GB), trying out several different chunks of data from different indices, and it's made no difference. |
Would it be possible to zip up the data directory and send it to me somehow (dropbox, email, etc)? I've tried a few combinations and am either setting up the test such that it doesn't mirror your setup, or there is something unique about your data that is causing the error. If I could use your actual data it would help debugging a ton. |
Well, sure! It's awfully kind of you to pursue this as far as you have. :) I've made a tarball out of the contents of |
Great, thanks! I'll start digging into this with a debugger and see if I can reproduce :) |
I've also tried indexing everything without the custom mapping files. It still doesn't work. And just to verify the I tried one more thing, and that yielded an interesting result. I tried including just one record in my index, one consisting of only a dozen short fields. That still returns In short, |
Hey @waldoj, really sorry for this huge delay. I'm co-authoring the Elasticsearch book, and we had a big deadline that I was frantically trying to make :) So I've loaded your data into Elasticsearch 0.90.9 using Elasticsearch-PHP v0.4.5 on PHP 5.3.10. It should be identical. But it seems to work on my end: date_default_timezone_set('UTC'); // To make PHP happy
echo "Version:".phpversion()."\n\n";
$config['logging'] = TRUE;
$client = new Elasticsearch\Client($config);
$params['index'] = 'business';
$params['body']['query']['match']['_all'] = 'Jaquith';
$result = $client->search($params);
print_r($result); Which emits (result list truncated for brevity):
Frankly, I have no idea what is going on at your end, since I just can't recreate it. Would you be willing to start mucking around with the Elasticsearch-php code and adding debug prints? I can give you a few locations to add which might help us figure out what's going on. Could you:
|
Oh, so you're so busy with your fancy Elasticsearch book, you don't have time to provide free technical support to a stranger? ;) If you can't recreate the bug, then there's not a thing that you can do. I've been in your position many times. I've run
PHP Version 5.3.10-1ubuntu3.13
Configurationapache2handler
Apache Environment
HTTP Headers Information
apc
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
memcached
mhash
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib
Additional Modules
Environment
PHP Variables
|
@waldoj I've seen similar issues in the Perl client when bad JSON or bad UTF8 has been inserted into ES directly (ie not via the client). Could this be the case? |
@clintongormley Do you mean the data being ingested contains mis-formatted JSON or UTF-8? If so, then I'm afraid that's not the case here. That was my initial suspicion, but unfortunately it wasn't borne out by my testing. This is the totality of the data being ingested (via a POST request directly to ElasticSearch, as you intuited): [
{
"status": "60",
"city": "IRVINE",
"name": "IN-N-OUT BURGERS",
"zip": "A9261-2000",
"street-2": "",
"street-1": "4199 CAMPUS DRIVE 9TH FL",
"requestor": "ARNOLD WENSINGER (CA) IN-N-OUT BURGERS",
"state": "C",
"date-expires": "2014-12-26",
"type": "C",
"id": "R000089"
}
] Obviously, the goal is to ingest much more, but this is my test record. It's valid JSON, and has no encoding errors, at least not that I can find. :) Though, now that you mention it, I think I'll try chopping this down to a single field (e.g., |
@waldoj do you wrap it in an array, as you show it there? The body should be an object only (ie |
Hmm, that's interesting. I use the bulk API format, which I've been providing like such: [{"index": {"_type": "8", "_index": "business"}},
{"status": "60", "city": "IRVINE", "name": "IN-N-OUT BURGERS", "zip": "A9261-2000", "requestor": "ARNOLD WENSINGER (CA) IN-N-OUT BURGERS", "date_expires": "2014-12-26", "state": "C", "street_1": "4199 CAMPUS DRIVE 9TH FL", "street_2": "", "type": "C", "id": "R000089"}] Now that you mention it, looking at the Bulk API documentation, there is no mention whatsoever of representing the entire request as an array. Elasticsearch itself happily indexes this data, which is why I figured that everything was A-OK with it. Perhaps, though, it's so liberal in what it's accepting that it winds up being a bug, not a feature. I'll try importing data again and see if that fixes it! |
Fixed! @clintongormley, you were 99% of the way there. (Or 100%, and I didn't get it. :) The problem wasn't the array enclosures (removing the enclosing But now Elasticsearch-php works. I'm not quite sure what's going on here—how Elasticsearch was happy with invalid JSON that Elasticsearch-php balked at, but now it's fixed. Seems to me like this is primarily a bug in my own JSON, secondarily a bug-as-feature in Elasticsearch, and in no way a bug in Elasticsearch-php. As I wrote in the initial ticket:
Thanks for IDing the stupid thing I was doing, Clinton. :) |
Leave it to a Perl guy to find the problem :) Glad you got it working! @clintongormley had mentioned the illegal JSON syntax to me a while ago, but I didn't think it was a problem because your dataset worked just fine on my end (and I didn't see any invalid JSON). Still not sure why the problem didn't reproduce itself, perhaps ES was polling a different set of documents on my computer so it never showed up. Oh well. Funnily enough, I have a bug report open at ES about this very issue: elastic/elasticsearch#7299 Elasticsearch only parses the first JSON object that it encounters. If that first JSON object is valid, the document is considered a success. The "gotcha" is that ES will still index the entire request body into the Technically this isn't a problem for ES, since it only displays the I thought I was checking for invalid JSON and throwing an exception, but sure enough, it's just returning the output of ...which happens to be NULL if the JSON was invalid. Sigh. Should have noticed this. I definitely count this as a bug, so we'll get this fixed to throw a real exception and helpful text :) Thanks again for the report and sticking through this whole time! |
Oh, good—I'm glad this wasn't all for nothing, and that I wasn't 100% at fault. :) Thanks for your help! |
I'm having a puzzling problem with a website that uses Elasticsearch—Elasticsearch is returning results to elasticsearch-php, which is then mysteriously failing to output them. This is with Elasticsearch v0.90.9, elasticsearch-php v0.4.5, and PHP v5.3.10. (Just in case, I've also tried elasticsearch-php v1.2.0, despite its incompatibility with pre-v1.0 Elasticsearch, which presented precisely the same problem.)
When I directly query my Elasticsearch index, Elasticsearch happily returns the results. That's if I make the request via cURL. If I make the request via elasticsearch-php, Elasticsearch still returns the results, but they don't make it past elasticsearch-php.
For example, here I search for a term that I know will return a small number of results (
Jaquith
, my last name) from my index (business
) of a couple of million records:The output of
var_dump($result)
isNULL
. Notfalse
, butNULL
. If I I deliberately specify invalid options, such as an invalid index (e.g.,$params['index'] = 'fake_index'
), then it returnsfalse
, so it's not like it can only returnNULL
.Where things get weird is when looking at
elasticsearch.log
. Here is what's logged from the execution of the above:Elasticsearch returns results just fine. Somewhere between elasticsearch-php receiving that JSON and returning the content as PHP it's becoming, simply,
NULL
.There's a non-trivial chance that I'm doing something stupid here, but I can't figure out what it is. Any ideas of what's going on?
The text was updated successfully, but these errors were encountered: