Saya memiliki pemetaan ini:
"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"
}
}
}
Dan pertanyaan ini:
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
}
Saya menunggu 25 hasil karena saya memiliki 25 posting yang terindeks. Tapi saya mendapatkan satu set kosong. Jika saya menghapus filter bersarang, semuanya berfungsi dengan baik. Saya ingin dapat memfilter objek bersarang
Sunting:
Dalam pengaturan saya, saya punya:
"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"
]
}
}
Apa yang saya lewatkan di sini.
Terima kasih
custom_analyzer
? Cara pengaturannya mungkin ada hubungannya dengan masalah Anda. - person Sloan Ahrens   schedule 06.01.2015{ "term": { "seller.firstName": "Test 3" } }
harus{ "term": { "seller.firstName": "test" } }
, atau yang serupa. Atau Anda perlu menyesuaikan alat analisa/pemetaan Anda. Namun sulit untuk memastikannya tanpa melakukan pengujian secara langsung. - person Sloan Ahrens   schedule 06.01.2015