deconst / content-service

An API for storing, indexing and retrieving documentation
MIT License
4 stars 9 forks source link

[ElasticSearch] Queries not working in 6.2 #134

Open nimbinatus opened 6 years ago

nimbinatus commented 6 years ago

Looks like the queries from https://github.com/deconst/content-service/blob/master/src/storage/remote.js#L375-L384 are somehow not rendering correctly. Needs to be examined.

<TDS> verbose: GET /search?q=deconstruct&categories%5B0%5D=deconst.horse
{ route: 'GET /search', reqDuration: 0 }
<TDS> trace:
{ message: 'Elasticsearch HTTP request',
   httpMethod: 'POST',
   requestUrl: 'https://<es_url>/envelopes_current/envelope/_search%3Ffrom=0&size=10&ignore_unavailable=true'>,
   requestBody: '{"query":{"bool":{"must":{"match":{"all":"deconstruct"},"filter":{"terms":{"categories":["deconst.horse"]}}}}},"highlight":{"fields":{"body":{}}}}',
   responseBody: '{"error":{"root_cause":[{"type":"parsing_exception","reason":"[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":57}],"type":"parsing_exception","reason":"[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":57},"status":400}',
   responseStatus: 400 }
<TDS> debug:
{ action: 'elasticsearch', message: 'Request complete' }
<TDS> error: Error performing search 
{ query: 'deconstruct',
   perPage: 10,
   pageNumber: 1,
   categories: [ 'deconst.horse' ],
   route: 'GET /search',
   reqDuration: 9,
   error: '[parsing_exception] [match] malformed query, expected [END_OBJECT] but found [FIELD_NAME], with { line=1 & col=57 }',
   statusCode: 400,
   stack: 'Error: [parsing_exception] [match] malformed query, expected [END_OBJECT] but found [FIELD_NAME], with { line=1 & col=57 }\n    at respond (/opt/app-root/src/node_modules/elasticsearch/src/lib/transport.js:307:15)\n    at checkRespForFailure (/opt/app-root/src/node_modules/elasticsearch/src/lib/transport.js:266:7)\n    at HttpConnector.<anonymous> (/opt/app-root/src/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n    at IncomingMessage.bound (/opt/app-root/src/node_modules/elasticsearch/node_modules/lodash/dist/lodash.js:729:21)\n    at emitNone (events.js:72:20)\n    at IncomingMessage.emit (events.js:166:7)\n    at endReadableNT (_stream_readable.js:923:12)\n    at nextTickCallbackWith2Args (node.js:458:9)\n    at process._tickDomainCallback (node.js:413:17)' }