I have a query, this one contains 2 "block" that are the same at 99% (except a very small difference).
The block contains a parameter, but the parameter is replaced only in the first one.
I join my query and parameters for review, I will also join the JSON error file.
{
"output": "./output_posts.html|json",
"params": {
"searchquery": "niko reflex",
"searchquery_fuz": "niko~reflex~",
"preferedKeywords": ""
}
}
POST /posts_index/_search(name="dslquery_posts")
{
"track_total_hits": true,
"from":0,
"size":10,
"_source": [
"id",
"tags",
"taxonomies",
"storesNames",
"geoLocations",
"storesIds",
"imageUri"
],
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"distance_feature": {
"field": "geoLocations",
"pivot": "10km",
"origin": [
-71.3,
41.15
]
}
},
{
"distance_feature": {
"field": "creationTime",
"pivot": "14d",
"origin": "now"
}
},
{
"query_string": {
"fields": [
"tags^3",
"taxonomies^5"
],
"query": "{{searchquery}}",
"fuzziness": "auto"
}
},
{
"query_string": {
"fields": [
"tags^3",
"taxonomies^5"
],
"query": "{{preferedKeywords}}",
"fuzziness": "auto"
}
},
{
"nested": {
"path": "imageTags",
"score_mode": "sum",
"query": {
"function_score": {
"query": {
"query_string": {
"fields": [
"imageTags.tag^5"
],
"query": "{{searchquery}}",
"fuzziness": "auto",
"default_operator": "AND"
}
},
"field_value_factor": {
"field": "imageTags.score",
"factor": 1,
"missing": 0
}
}
}
}
},
{
"nested": {
"path": "imageTags",
"score_mode": "sum",
"query": {
"function_score": {
"query": {
"query_string": {
"fields": [
"imageTags.tag^2"
],
"query": "{{searchquery}}",
"fuzziness": "auto",
"default_operator": "OR"
}
},
"field_value_factor": {
"field": "imageTags.score",
"factor": 1,
"missing": 0
}
}
}
}
}
]
,"filter": [
{
"simple_query_string" : {
"query": "{{searchquery_fuz}}",
"fields": ["tags", "description", "storesNames"],
"default_operator": "and"
}
}
]
}
},
"functions": [
{
"script_score": {
"script": {
"source": "Math.sqrt(doc['commentsCount'].value)"
}
}
},
{
"script_score": {
"script": {
"source": "Math.log(2 + doc['likesCount'].value)"
}
}
},
{
"script_score": {
"script": {
"source": "Math.log(2 + doc['viewsCount'].value)"
}
}
}
],
"score_mode": "avg"
}
}
}
"reason": {
"type": "query_shard_exception",
"reason": "Failed to parse query [{{searchquery}}]",
"index_uuid": "1mTOIlphRuGPtSNQATOBtQ",
"index": "posts_index",
"caused_by": {
"type": "parse_exception",
"reason": "Cannot parse '{{searchquery}}': Encountered \" \"}\" \"} \"\" at line 1, column 13.\r\nWas expecting:\r\n \"TO\" ...\r\n ",
"caused_by": {
"type": "parse_exception",
"reason": "Encountered \" \"}\" \"} \"\" at line 1, column 13.\r\nWas expecting:\r\n \"TO\" ...\r\n "
}
}
}
Hi,
I have a query, this one contains 2 "block" that are the same at 99% (except a very small difference).
The block contains a parameter, but the parameter is replaced only in the first one.
I join my query and parameters for review, I will also join the JSON error file.
And here the output:
You see, it try to parse {{searchquery}} :-(