[英]es query of suggest in elasticsearch 5.0.1
我有一個問題,我想搜索結果使用建議。 我的類型架構是這樣的
`
{
"name": {
"input": [
"uers1"
]
},
"usertype": 1
}{
"name": {
"input": [
"uers2"
]
},
"usertype": 2
}`
我想通過建議搜索數據,像這樣的查詢
`{
"suggest": {
"person_suggest": {
"text": "us",
"completion": {
"field": "name"
}
}
}
}`
像這樣的結果
`{
"_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
}
]
}
]
} `
但是我只希望結果是usertype = 1,就像在mysql中添加where條件。 任何人都可以幫助我嗎?我想要DSL查詢。
您無法完全過濾建議查詢。 為每個用戶類型創建不同的完成字段或在nGram分析器中使用標准查詢的問題解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.