ElasticSearch: mappings for fields that are sorted often -


suppose have field "epoch_date" sorted when elastic search queries. how should map field? right now, have stored: yes. should index though field not count towards relevancy scoring? should add field if intend sort on field often, more efficient?

{     "tweet" : {         "properties" : {             "epoch_date" : {                 "type" : "integer",                 "store" : "yes"             }         }     } } 

there's nothing need change sort on field given mapping. can sort on field if it's indexed, , default "index":"yes" numeric or dates. can not set numeric type analyzed, since there's no text analyze. also, better use date type date instead of integer.

sorting can memory expensive if field sorting on has lot of unique terms. make sure have enough memory it. also, keep in mind sorting on specific field throw away relevance ranking, big part of search engine about.

whether want store field doesn't have sorting, way retrieve in order return search results. if use _source field (default behaviour) there's no reason store specific fields. if ask specific fields using fields option when querying, stored fields retrieved directly lucene rather extracted _source field parsing json.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -