I am using the Elasticsearch Rails gem and I am using two things in my model:
def as_indexed_json
end
and
settings index: { number_of_shards: 1 } do
  mapping dynamic: 'false' do
    indexes :id
    indexes :customer do                                                                                                                                                                                                                          
      indexes :first_name
    end
  end
end 
I have read the documentation and I am not understanding what the purposes of each of these are. What I am trying to figure out is are these used for searching the indexed data or for creating the indexed data?
The as_indexed_json method is used to override what data will be send to ES for indexing.
How ES is indexing the data you send is configured by the second part.
To search with ES in the indexed data, you have to perform a _query.
Feel free to ask if you need more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With