Elasticsearch I/O exception during suggest phase with an inline collate query


(Hugo Dellinger) #1

I have a collate query within a phrase_suggestion query in ES 5.2. In order to do that, my collate query is an inline mustache template. However, I'm getting an I/O exception error telling me that there's an unexpected '}' character when I'm passing a filter object to my query with the toJson mustache tag ( com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)) )

What's surprising is that my query template seem to be OK when I use the _search/template endpoint. I don't get any error trough this way.

Here is my query :

{
	"index": "arrets27",
	"type": "arret",
	"body": {
	  
		"suggest": {
			"text": "secs, Bovero,",
			"simple_phrase": {
				"phrase": {
					"field": "contenu_html.trigram",
					"size": 1,
					"gram_size": 3,
					"max_errors": 2,
					"confidence": 2.5,
					"direct_generator": [{
						"field": "contenu_html.trigram",
						"suggest_mode": "always"
					}, {
						"field": "contenu_html.reverse",
						"suggest_mode": "always",
						"pre_filter": "reverse",
						"post_filter": "reverse"
					}, {
						"field": "contenu_html.nostem_with_accents",
						"suggest_mode": "missing"
					}],
					"collate": {
						"query": {
							"params": {
								"filters": [{
									"bool": {
										"should": [{
											"term": {
												"juridiction.raw": "CE"
											}
										}]
									}
								}, {
									"bool": {
										"should": [{
											"term": {
												"search_access.raw": "ALL"
											}
										}, {
											"term": {
												"search_access.raw": "FREE_TRIAL"
											}
										}, {
											"term": {
												"search_access.raw": "RESTRICTED"
											}
										}]
									}
								}]
							},
							"inline": "{\"bool\":{\"must\":[{\"multi_match\":{\"query\":\"{{suggestion}}\",\"analyzer\":\"query_analyzer\",\"type\":\"cross_fields\",\"fields\":[\"doc_id^2\",\"search_title^0.1\",\"formation^2\",\"form_dec_att^1\",\"president^1\",\"avocat_gl^1\",\"avocats^1\",\"rapporteur^1\",\"commissaire_gvt^1\",\"citation_jp^0.05\",\"keywords^2\",\"liens^2\",\"numero^4\",\"numero_affaire^4\",\"other_numbers^4\",\"solution^2\",\"nature^2\",\"ville^2\",\"siege_appel^2\",\"juri_prem^2\",\"lieu_prem^2\",\"ecli^2\",\"reference_url^2\",\"wikipedia^100\",\"ancien_id^2\",\"type_rec^2\",\"nor^2\",\"nature_qualifiee^2\",\"loi_def^2\",\"titre_jo^2\",\"loi_def_nor^2\",\"loi_def_num^2\",\"saisines^2\",\"observations^2\",\"publi_bull_ref^4\",\"ref_numeros_affaires^2\",\"organisations^2\",\"issue^2\",\"resolution_number^2\",\"doctype_branch^2\",\"legifrance_ref^2\",\"reference_citation^2\",\"inpi_ref^2\",\"inpi_partan^0.1\",\"inpi_marq^0.1\",\"inpi_prod^2\",\"inpi_ti^2\",\"inpi_obj^2\",\"inpi_cib^2\",\"inpi_ct^2\",\"demandeurs_names^0.1\",\"defendeurs_names^0.1\",\"comment_titles^1\",\"citation_titles^0.1\",\"contenu_html^1\",\"saisines_html^2\",\"observations_html^2\",\"sommaire_ana^2\",\"comment_contents^0.5\",\"citation_contents^0.05\"],\"operator\":\"and\"}}],\"filter\":{{#toJson}}filters{{/toJson}}}}"
						},
						"prune": true
					}
				}
			}
		}
	}
}

Here is the error log I'm getting in ES (in a gist because of the character limit) : Gist

Do you have any idea why I'm getting this error ?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.