elasticsearch-rails icon indicating copy to clipboard operation
elasticsearch-rails copied to clipboard

Documentation of "settings" and "mapping" method?

Open slhck opened this issue 5 years ago • 10 comments

I see the example for defining settings and mapping for an index/model in the README of https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model:

class Article
  settings index: { number_of_shards: 1 } do
    mappings dynamic: 'false' do
      indexes :title, analyzer: 'english', index_options: 'offsets'
    end
  end
end

However, I could not find a documentation for settings and mapping. This got me quite confused. For example, there is no easy way to tell that:

  • The dynamic value has to be a String and not a boolean
  • The indexes method allows a block to create nested structures

It is also not shown in the documentation:

  • Simple examples for mapping class method: https://rubydoc.info/gems/elasticsearch-model/Elasticsearch/Model/Indexing/ClassMethods:mapping
  • General overview of the mapping structure defines indexes but there is no documentation

Would it make sense to at least expand the examples to show how the indexes method can be used?

slhck avatar Nov 13 '19 14:11 slhck

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '20 13:08 stale[bot]

Ping, anyone?

slhck avatar Aug 31 '20 13:08 slhck

Hi @slhck, Thanks for reporting this! We've installed the stale bot in this repository since there are issues from a long time ago, and I need to clean up the issues to know which ones are old/deprecated/no longer valid, etc. The issue won't be closed now there's been activity and I'll get to it as soon as possible.

picandocodigo avatar Aug 31 '20 20:08 picandocodigo

Thanks for the feedback!

slhck avatar Sep 01 '20 07:09 slhck

I also wonder about the difference between the examples below:

settings index: { number_of_shards: 1 } do
  mappings dynamic: 'false' do
    indexes :title, analyzer: 'english', index_options: 'offsets'
  end
end
settings index: { number_of_shards: 1 } 
mappings dynamic: 'false' do
  indexes :title, analyzer: 'english', index_options: 'offsets'
end

What's the point of nesting mappings inside settings?

tonytonyjan avatar Apr 15 '21 10:04 tonytonyjan

I can't find suitable documentation either.

goandgit avatar May 21 '21 18:05 goandgit

I keep coming back to this issue, and the mapping and setting configuration still confuses me. I have, so far, been unable to simply provide my own mapping. I thought that supplying my own mapping would work:

def mapping
  {
    properties: {
      geolocation: {
        properties: {
          latlon: {
            type: "geo_point"
          }
        }
      }
    }
  }
end

but alas, it does not pick that up when indexing.

Could anyone please update the documentation with a description of how these fields work?

slhck avatar May 05 '22 09:05 slhck

Same here, I find it quite hard to figure out how to configure something like language specific stopwords using the DSL methods. Some more examples would be extremely helpful I suppose.

xijo avatar Nov 27 '22 10:11 xijo

I'll also would like documentation on this. At least as a noob in ruby on rails, I would appreciate if even someone could direct me to where "settings" and "mappings" are defined so I can at least go look at how its implemented in the code

maruhanpark avatar Dec 22 '22 11:12 maruhanpark

Still confused by this, could @picandocodigo help, please?

slhck avatar Dec 03 '23 19:12 slhck