Query -elastic search-Facet slor vs aggregation

Hi
Currently in solr we are using facets to implement autocomplete functionality and we are using title has the parameter also year for filtering the data.
This looks something similar to this
select title from tablename where title like'A%' and year=2018
group by title
Currently we are using facets in solr , what is the best approach .Should i use aggregation to do group by and can i use it along match query?
Also if i am using aggs , i get an error coz of my mapping .
I have made my changes to my mapping in reference to this url
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-analyzer.html

GET indexname/type/_Search
{

"aggregations": {
"total_per_year": {
"terms": {
"field": "title"
}
}
}
}
I am getting this error "root_cause": [

    "type": "illegal_argument_exception",
    "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [civil_service_title] 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."

If you are using all defaults try on title.keyword field instead.

I get this as result if i use keyword "aggregations": {
"service_title": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}
}

Mapping for my title is as follows:
"title":{
"type":"text",
"analyzer": "autocomplete",
"search_analyzer": "standard"

       }

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.