-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
how to use two contextQuery #329
Comments
According to Elasticsearch master branch, you are correct: It's a map (see here). I can't seem to find the The code in Elastic that does it wrong is here. I will need to see if this is wrong/deprecated sometimes during 2.x. And if so, I will fix it on the next release. |
case 1:
this is correct,you can look |
Context queries of a suggester need to be serializes as a dictionary, not an array. See #329
Context queries of a suggester need to be serializes as a dictionary, not an array. See #329
I'm about to release v3.0.45 and v2.0.52 which should fix this issue. Please comment here if that doesn't solve your problem. Thanks for contributing to Elastic. |
Context queries of a suggester need to be serializes as a dictionary, not an array. See #329
Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.
Which version of Elastic are you using?
[ ] elastic.v3 (for Elasticsearch [2.x)]
Please describe the expected behavior
I have a suggester index.it contains two context. it shows :
localhost:9200/suggester/suggest/_mapping -d '{
"suggest": {
"properties": {
"name": {
"type": "string"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"search_analyzer": "simple",
"payloads": true,
"context": {
"app": {
"type": "category",
"default": 1
},
"add_app": {
"type": "category",
"default": 2
}
}
}
}
}
}'
while,in my project,I want to suggest it by contextQuery.the code is :
suggest_build:=elastic.NewCompletionSuggester("suggest")
suggest_build.Field("suggest")
suggest_build.Size(20)
suggest_build.ContextQueries(elastic.NewSuggesterCategoryQuery("app","1"))
suggest_build.ContextQueries(elastic.NewSuggesterCategoryQuery("add_app","2"))
but,this code build a json to es is :
"context":[{"app":"1"},{"add_app":2}]
this is wrong,the correct format is:
"context":{"app":"1","add_app":"2"}
this is why?I don't know how to deal with it.
Please describe the actual behavior
Any steps to reproduce the behavior?
The text was updated successfully, but these errors were encountered: