Elasticsearch multi_field type search and sort issue -
i'm having issue multi_field
mapping type in 1 of indexes , not sure issue is. use similar mapping in index , don't have these issues. es version 90.12
i have set have mapping looks this:
{ "settings": { "index": { "number_of_shards": 10, "number_of_replicas": 1 } }, "mappings": { "production": { "properties": { "production_title": { "type": "multi_field", "fields": { "production_title_edgengram": { "type": "string", "index": "analyzed", "index_analyzer": "autocomplete_index", "search_analyzer": "autocomplete_search" }, "production_title": { "type": "string", "index": "not_analyzed" } } } } } } }
the .yml
looks this:
index: mapper: dynamic: true analysis: analyzer: autocomplete_index: tokenizer: keyword filter: ["lowercase", "autocomplete_ngram"] autocomplete_search: tokenizer: keyword filter: lowercase ngram_index: tokenizer: keyword filter: ["ngram_filter"] ngram_search: tokenizer: keyword filter: lowercase filter: autocomplete_ngram: type: edgengram min_gram: 1 max_gram: 15 side: front ngram_filter: type: ngram min_gram: 2 max_gram: 8
so doing this:
curl -xget 'http://localhost:9200/productionindex/production/_search' -d '{ "sort": [ { "production_title": "asc" } ], "size": 1 }'
and
curl -xget 'http://localhost:9200/productionindex/production/_search' -d '{ "sort": [ { "production_title": "desc" } ], "size": 1 }'
i end exact same result somewhere in middle of alphabet:
"production_title": "il, 'hoodoo love'"
however, if this:
{ "query": { "term": { "production_title": "il, 'hoodoo love'" } } }
i 0 results.
furthermore, if this:
{ "query": { "match": { "production_title_edgengram": "il" } } }
i 0 results.
if don't use multi_field
, separate them out, can search on them fine, (term , autocomplete) still can't sort.
while indexing sending production_title
when indexing multi_field
.
does have idea going on here?
below please find explain (last result brevity)
{ "_shard": 6, "_node": "j-d2sypct0qzt1ld1rckog", "_index": "productionindex", "_type": "production", "_id": "casting_call.productiondatetime.689", "_score": null, "_source": { "venue_state": "wa", "updated_date": "2014-03-10t12:08:13.927273", "django_id": 689, "production_types": [ 69, 87, 89 ], "production_title": "wa, 'footloose'" }, "sort": [ null ], "_explanation": { "value": 1.0, "description": "constantscore(cache(_type:audition)), product of:", "details": [ { "value": 1.0, "description": "boost" }, { "value": 1.0, "description": "querynorm" } ] } }
from curl:
curl -xpost 'http://localhost:9200/productionindex/production/_search?pretty=true&explain=true' -d '{ "query": { "match_all": {} }, "sort": [ { "production_title": { "order": "desc" } } ] }'
Comments
Post a Comment