Ranges of support and the condition of the Boolean condition in the search rails 5?

I am using Searchkick in my Rails 5 application and I am trying to maintain ranges and conditions of boolean conditions in the application.

My range request is where:

Model.search '*', where: { _or: [ { age_years: { gte: "5", lte: "7" } } ] }

But I got an error as shown below:

"caused_by":{"type":"illegal_argument_exception","reason":"Cannot search on field [age_years] since it is not indexed."}

Also I tried with aggs request like:

options = {:aggs=>{:age_years=>{:ranges=>[{:from=>7, :to=> 12}]}}} Model.search("*", options)

But I got an error as shown below:

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

My term query like:

Model.search "*", where: {lc_vet_care: true}

But I did not index the error as well as the range where the request error.

how can i fix this with searchkick?

+6
source share

All Articles