Hi Yuuvis Team
I are trying to return search results ordered by relevance. We have encountered the following questions/issues:
POST: {"query":{"statement":"SELECT name, SCORE() s FROM person WHERE (name CONTAINS('xxx') AND name CONTAINS('xxx')) OR name CONTAINS('xxx') OR name CONTAINS('xxx') ORDER BY s ASC","skipCount":10,"maxItems":5}} "service": "search", "httpErrorCode": 422, "errorMessage": "ResponseException: method [GET], host [http://elasticsearch:9200], URI [/yuuvis/_search?request_cache=true], status line [HTTP/1.1 400 Bad Request]\n{\"error\":{\"root_cause\":[{\"type\":\"x_content_parse_exception\",\"reason\":\"[1:923] [_score] unknown field [unmapped_type]\"}],\"type\":\"x_content_parse_exception\",\"reason\":\"[1:923] [_score] unknown field [unmapped_type]\"},\"status\":400}",
POST: {"query":{"statement":"SELECT name, SCORE() s FROM person WHERE (name CONTAINS('xxx') AND name CONTAINS('xxx')) OR name CONTAINS('xxx') OR name CONTAINS('xxx') ORDER BY s ASC","skipCount":10,"maxItems":5}}
"service": "search",
"httpErrorCode": 422,
"errorMessage": "ResponseException: method [GET], host [http://elasticsearch:9200], URI [/yuuvis/_search?request_cache=true], status line [HTTP/1.1 400 Bad Request]\n{\"error\":{\"root_cause\":[{\"type\":\"x_content_parse_exception\",\"reason\":\"[1:923] [_score] unknown field [unmapped_type]\"}],\"type\":\"x_content_parse_exception\",\"reason\":\"[1:923] [_score] unknown field [unmapped_type]\"},\"status\":400}",
To sort by the score value, you must assign an alias name to the SCORE () function.Select all invoices and their score value where the field 'status' either contains 'reminder', 'discount' or 'delay', with the result list sorted in ascending order of alias s (score value).SELECT *,SCORE() s FROM invoice WHERE status CONTAINS('reminder discount delay') ORDER BY s ASC;
To sort by the score value, you must assign an alias name to the SCORE () function.
Select all invoices and their score value where the field 'status' either contains 'reminder', 'discount' or 'delay', with the result list sorted in ascending order of alias s (score value).
SELECT *,SCORE() s FROM invoice WHERE status CONTAINS('reminder discount delay') ORDER BY s ASC;
Thank you in advance for any clarifications.
Kind regards
Nicole
Hi Nicole,
56 questions
65 answers
43 comments
407 users