[英]es query of suggest in elasticsearch 5.0.1
I have a question that i want to search a result use suggest. 我有一个问题,我想搜索结果使用建议。 My type schema like this
我的类型架构是这样的
`
{
"name": {
"input": [
"uers1"
]
},
"usertype": 1
}{
"name": {
"input": [
"uers2"
]
},
"usertype": 2
}`
I want search data by suggest, the query like these 我想通过建议搜索数据,像这样的查询
`{
"suggest": {
"person_suggest": {
"text": "us",
"completion": {
"field": "name"
}
}
}
}`
And the result like these 像这样的结果
`{
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"person_suggest": [
{
"text": "word",
"offset": 0,
"length": 4,
"options": [
{
"name": "user1",
"usertype": 1,
"score": 1
},
{
"text": "user2",
"usertype": 2,
"score": 1
}
]
}
]
} `
But I only want the result is usertype = 1, like add a where condition in mysql. 但是我只希望结果是usertype = 1,就像在mysql中添加where条件。 Any body can help me ?I want a DSL query.Thx a lot.
任何人都可以帮助我吗?我想要DSL查询。
You can'nt filter in completion suggest queries. 您无法完全过滤建议查询。 A solution to your problem to make different completion fields for each usertype or use standard queries with nGram analyzers.
为每个用户类型创建不同的完成字段或在nGram分析器中使用标准查询的问题解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.