Hello, I use this code for sorting products according the price:
"sort":[
{ "price": { "order": "desc" } }
]
I know that it doesn't work because field price is unmapped, so it takes probably as "text" so I wonder if I can change query somehow or I have to remove all data, map fields and reindex all data back.
This is error:
[Request] ** [http://localhost:9200]-[400] [illegal_argument_exception] Fielddata is disabled on text fields by default. Set fielddata=true on [price] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead., called from sub modified(Search::Elasticsearch::Role::Client::Direct::__ANON__) at (eval 647) line 323. With vars: {'request' => {'body' => ' { "query":{ "constant_score":{ "filter":{ "bool":{ "must":[ { "term":{ "status":"y" } }, { "range":{ "datetime_publish_start":{ "lte":"now/h" } } } ], "should":[ { "term": { "cat_path": 3 } } ], "must_not":[ { "term":{ "metahash.meta.sold_out":"y" } } ] } } } }, "sort":[ { "price": { "order": "desc" } } ] } ','path' => '/cyclone3.bellakabelky_sk/a910_product/_search','mime_type' => 'application/json','qs' => {'size' => 61,'from' => 0},'serialize' => 'std','method' => 'GET','ignore' => []},'body' => {'error' => {'phase' => 'query','reason' => 'all shards failed','failed_shards' => [{'shard' => 0,'index' => 'cyclone3.bellakabelky_sk','node' => 'GruggyayQTOMdM0ycEyvIw','reason' => {'type' => 'illegal_argument_exception','reason' => 'Fielddata is disabled on text fields by default. Set fielddata=true on [price] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.'}}],'grouped' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),'caused_by' => {'type' => 'illegal_argument_exception','caused_by' => {'type' => 'illegal_argument_exception','reason' => 'Fielddata is disabled on text fields by default. Set fielddata=true on [price] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.'},'reason' => 'Fielddata is disabled on text fields by default. Set fielddata=true on [price] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.'},'root_cause' => [{'reason' => 'Fielddata is disabled on text fields by default. Set fielddata=true on [price] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.','type' => 'illegal_argument_exception'}],'type' => 'search_phase_execution_exception'},'status' => 400},'status_code' => 400}