-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 Template - conditional clauses not rendering correctly #8308
Comments
I was testing it with ES 1.3.0 |
Fixed asciidoc typo Closes #8308
Fixed asciidoc typo Closes #8308
@clintongormley thanks for clarifying this. Out of curiosity, does the template example in question work for you? |
@lukas-vlcek did you wrap it in a I've just pushed another improvement to the docs to include both of the above elements |
@clintongormley thanks for this, but still I am unable to get search template with section work. Here is trivial recreation https://gist.github.com/lukas-vlcek/56540a7e8206d122d55c |
Just in case here is excerpt from server log:
|
@lukas-vlcek I can't get this working either. No idea what is going on here :( |
@clintongormley thanks for look at this. Shall I change the title of this issue and remove the [DOC] part? It is probably not a DOC issue anymore, is it? |
After looking deep inside the code, I am wondering has this (i.e. the conditional clause thing) been ever working? The root clause is, inside the JsonXContentParser.java:nextToken() method, the parser.nextToken() throws an exception straight out of the box when it encounters the clause like {{#use_size}}. I guess such clause has not been implemented to be recognized yet. Notice that the parser is of type org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser . It looks like we have to override the UTF8StreamJsonParser's nextToken() method and do some look ahead for the conditional clauses. |
@wwken As I understand it, the JSON parser should never see this the This would be much easier to debug if we had #6821 |
…lastic#8308 - implemented the conditional parsing capabilities - attached few junit test cases to test it
…lastic#8308 - implemented the conditional parsing capabilities - attached few junit test cases to test it (reverted from commit bf1ae31)
I fixed it. Please refer to this pull request: https://github.com/elasticsearch/elasticsearch/pull/8376/files |
thanks @wwken - we'll take a look and get back to you |
@clintongormley #8393 is my try to fix this issue. If you find this relevant and to the point then it might make sense to consider renaming this issue again to more general description (I think the main issue here is broken parser logic of TemplateQueryParser in case the template value is a single string token. In other words I think there is more general issue not directly related to conditional clauses only). |
@lukas-vlcek I think for sure your solution is better! I have two suggestions on it though (minor, not any important):
thanks |
@wwken thanks for looking at this. I am going to wait if ES devs give any feedback. May be they will want to fix it in very different approach. Who knows... |
Bump. Is there any plan to have this fixed in 1.4? Or even backporting it to 1.3? We would like to make use of Search Templates but this issue is somehow limiting us. How can I help with this? |
…d string. Closes elastic#8308 - Search template is correctly parsed if it is provided as single escaped string - Ignore exceptions in case of second parsing of template content (assuming it is escaped template string content) - New tests for relevant use cases
…d string. Closes elastic#8308 - Search template is correctly parsed if it is provided as single escaped string - Ignore exceptions in case of second parsing of template content (assuming it is escaped template string content) - New tests for relevant use cases Conflicts: src/main/java/org/elasticsearch/search/SearchService.java
Closed by #11512 |
@clintongormley correct, this issue was created before I opened more general PR. Closing... |
Fixed asciidoc typo Closes elastic#8308
Is the example of filtered query template [1] working? It seems to contain extra
</6>
string which seems as an issue to me. I am unable to test this example even after I remove this extra string.[1] http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.3/search-template.html#_conditional_clauses
The text was updated successfully, but these errors were encountered: