ฉันมีการแมปนี้:
"post": {
"model": "Post",
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string",
"analyzer": "custom_analyzer",
"boost": 5
},
"description": {
"type": "string",
"analyzer": "custom_analyzer",
"boost": 4
},
"condition": {
"type": "integer",
"index": "not_analyzed"
},
"categories": {
"type": "string",
"index": "not_analyzed"
},
"seller": {
"type": "nested",
"properties": {
"id": {
"type": "integer",
"index": "not_analyzed"
},
"username": {
"type": "string",
"analyzer": "custom_analyzer",
"boost": 1
},
"firstName": {
"type": "string",
"analyzer": "custom_analyzer",
"boost": 3
},
"lastName": {
"type": "string",
"analyzer": "custom_analyzer",
"boost": 2
}
}
},
"marketPrice": {
"type": "float",
"index": "not_analyzed"
},
"currentPrice": {
"type": "float",
"index": "not_analyzed"
},
"discount": {
"type": "float",
"index": "not_analyzed"
},
"commentsCount": {
"type": "integer",
"index": "not_analyzed"
},
"likesCount": {
"type": "integer",
"index": "not_analyzed"
},
"featured": {
"type": "boolean",
"index": "not_analyzed"
},
"bumped": {
"type": "boolean",
"index": "not_analyzed"
},
"created": {
"type": "date",
"index": "not_analyzed"
},
"modified": {
"type": "date",
"index": "not_analyzed"
}
}
}
และแบบสอบถามนี้:
GET /develop/_search?search_type=dfs_query_then_fetch
{
"query": {
"filtered" : {
"query": {
"bool": {
"must": [
{ "match": { "title": "post" }}
]
}
},
"filter": {
"bool": {
"must": [
{"term": {
"featured": 0
}},
{
"nested": {
"path": "seller",
"filter": {
"bool": {
"must": [
{ "term": { "seller.firstName": "Test 3" } }
]
}
},
"_cache" : true
}}
]
}
}
}
},
"sort": [
{
"_score":{
"order": "desc"
}
},{
"created": {
"order": "desc"
}
}
],
"track_scores": true
}
ฉันรอ 25 ผลลัพธ์เพราะฉันมี 25 โพสต์ที่จัดทำดัชนี แต่ฉันได้ชุดเปล่ามา ถ้าฉันลบตัวกรองที่ซ้อนกันทั้งหมดก็ใช้ได้ดี ฉันต้องการที่จะกรองวัตถุที่ซ้อนกันได้
แก้ไข:
ในการตั้งค่าของฉันฉันมี:
"analyzer": {
"custom_analyzer": {
"type": "custom",
"tokenizer": "nGram",
"filter": [
"stopwords",
"asciifolding",
"lowercase",
"snowball",
"english_stemmer",
"english_possessive_stemmer",
"worddelimiter"
]
},
"custom_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"stopwords",
"asciifolding",
"lowercase",
"snowball",
"english_stemmer",
"english_possessive_stemmer",
"worddelimiter"
]
}
}
สิ่งที่ฉันหายไปที่นี่
ขอบคุณ
custom_analyzer
ได้หรือไม่ วิธีการตั้งค่าอาจมีบางอย่างเกี่ยวข้องกับปัญหาของคุณ - person Sloan Ahrens   schedule 06.01.2015{ "term": { "seller.firstName": "Test 3" } }
จะต้องเป็น{ "term": { "seller.firstName": "test" } }
หรืออะไรทำนองนั้น หรือคุณจะต้องปรับเครื่องวิเคราะห์/การแมปของคุณ แต่ก็ยากที่จะพูดอย่างแน่นอนหากไม่มีการทดสอบโดยตรง - person Sloan Ahrens   schedule 06.01.2015