I'm trying to query two types and want to boost on of them!
I have tried this way. But i wan't successful. Can someone help? How can I
do boost a type?
GET /my_index/my_type1,my_type2/_search
{
"query": {
"match": {
"value.autocomplete": "lorem ipsum"
},
"function_score": {
"script_score": {
"script": "doc['_type'].value == 'my_type2' ? _score * 2 : _score"
}
}
}
}
And this is the error i have got
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query],
all shards failed; shardFailures {[3-5dZONwRn2_FJxQr7nGnw][my_index][2]:
SearchParseException[[my_index][2]: query[value.autocomplete:palais
value.autocomplete:stoclet value.autocomplete:sessel],from[-1],size[-1]:
Parse Failure [Failed to parse source [{\n "query": {\n "match":
{\n "value.autocomplete": "Palais Stoclet Sessel"\n },\n
"function_score": {\n "script_score": {\n "script":
"doc['_type'].value == 'my_type2' ? _score * 2 : _score"\n }, \n
"query": {},\n "functions": [\n {}\n ]\n }\n
}\n}\n]]]; nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "function_score"]; }{[3-5dZONwRn2_FJxQr7nGnw][my_index][3]:
SearchParseException[[my_index][3]: query[value.autocomplete:palais
value.autocomplete:stoclet value.autocomplete:sessel],from[-1],size[-1]:
Parse Failure [Failed to parse source [{\n "query": {\n "match":
{\n "value.autocomplete": "Palais Stoclet Sessel"\n },\n
"function_score": {\n "script_score": {\n "script":
"doc['_type'].value == 'my_type2' ? _score * 2 : _score"\n }, \n
"query": {},\n "functions": [\n {}\n ]\n }\n
}\n}\n]]]; nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "function_score"]; }{[3-5dZONwRn2_FJxQr7nGnw][my_index][4]:
SearchParseException[[my_index][4]: query[value.autocomplete:palais
value.autocomplete:stoclet value.autocomplete:sessel],from[-1],size[-1]:
Parse Failure [Failed to parse source [{\n "query": {\n "match":
{\n "value.autocomplete": "Palais Stoclet Sessel"\n },\n
"function_score": {\n "script_score": {\n "script":
"doc['_type'].value == 'my_type2' ? _score * 2 : _score"\n }, \n
"query": {},\n "functions": [\n {}\n ]\n }\n
}\n}\n]]]; nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "function_score"]; }{[3-5dZONwRn2_FJxQr7nGnw][my_index][0]:
SearchParseException[[my_index][0]: query[value.autocomplete:palais
value.autocomplete:stoclet value.autocomplete:sessel],from[-1],size[-1]:
Parse Failure [Failed to parse source [{\n "query": {\n "match":
{\n "value.autocomplete": "Palais Stoclet Sessel"\n },\n
"function_score": {\n "script_score": {\n "script":
"doc['_type'].value == 'my_type2' ? _score * 2 : _score"\n }, \n
"query": {},\n "functions": [\n {}\n ]\n }\n
}\n}\n]]]; nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "function_score"]; }{[3-5dZONwRn2_FJxQr7nGnw][my_index][1]:
SearchParseException[[my_index][1]: query[value.autocomplete:palais
value.autocomplete:stoclet value.autocomplete:sessel],from[-1],size[-1]:
Parse Failure [Failed to parse source [{\n "query": {\n "match":
{\n "value.autocomplete": "Palais Stoclet Sessel"\n },\n
"function_score": {\n "script_score": {\n "script":
"doc['_type'].value == 'my_type2' ? _score * 2 : _score"\n }, \n
"query": {},\n "functions": [\n {}\n ]\n }\n
}\n}\n]]]; nested: ElasticsearchParseException[Expected field name but got
START_OBJECT "function_score"]; }]",
"status": 400
}
Thank you for helping in advance
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e4e6c4f1-a009-4e06-8b2d-0f829846dcf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.