Skip to content

Documentation of "settings" and "mapping" method? #913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
slhck opened this issue Nov 13, 2019 · 11 comments
Open

Documentation of "settings" and "mapping" method? #913

slhck opened this issue Nov 13, 2019 · 11 comments
Labels

Comments

@slhck
Copy link

slhck commented Nov 13, 2019

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:

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

@stale
Copy link

stale bot commented Aug 31, 2020

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 stale bot added the stale label Aug 31, 2020
@slhck
Copy link
Author

slhck commented Aug 31, 2020

Ping, anyone?

@stale stale bot removed the stale label Aug 31, 2020
@picandocodigo
Copy link
Member

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.

@slhck
Copy link
Author

slhck commented Sep 1, 2020

Thanks for the feedback!

@stale stale bot added the stale label Nov 1, 2020
@picandocodigo picandocodigo added pinned and removed stale labels Nov 2, 2020
@elastic elastic deleted a comment from stale bot Nov 2, 2020
@tonytonyjan
Copy link

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?

@goandgit
Copy link

I can't find suitable documentation either.

@slhck
Copy link
Author

slhck commented May 5, 2022

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?

@xijo
Copy link

xijo commented Nov 27, 2022

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.

@maruhanpark
Copy link

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

@slhck
Copy link
Author

slhck commented Dec 3, 2023

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

@jeantristan
Copy link

still confused too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants