Mike Riley Mike Riley - 1 year ago 147
Ruby Question

Elasticsearch Rails as_indexed_json vs mappings

I am using the Elasticsearch Rails gem and I am using two things in my model:

def as_indexed_json



settings index: { number_of_shards: 1 } do
mapping dynamic: 'false' do


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?

gfd gfd
Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download