Skip to content
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

Add runtime_mappings support #887

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TakuyaKurimoto
Copy link

@TakuyaKurimoto TakuyaKurimoto commented May 15, 2023

Hello.
One time I wanted to use runtime_mappings, but in chewy I had to write the following code because chewy does not support runtime_mappings .

q = HogeIndex.query({}).render
q[:body][:runtime_mappings] = {"field1"=>{type: 'keyword', :script=>{:lang=>"painless", :source=>"emit('some script here')"}}}
HogeIndex.client.search(body: q[:body])

This is a bit inconvenient, so I was wondering if you could support runtime_mappings in chewy as well?

If this code is merged, it will be possible to do something like the code below

CitiesIndex
  .runtime_mappings(
    field1: {
      type: 'keyword',
      :script=>{
        :lang=>"painless",
        :source=>"emit('some script here')"
      }
    }
  )
  .aggs(
    field1: {
      terms: {
        field: "field1"
      }
    }
  )

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the changelog if the new code introduces user-observable changes. See changelog entry format for details.

@TakuyaKurimoto TakuyaKurimoto force-pushed the feature/add-runtime-mappings branch 2 times, most recently from 0bcc0af to 6a7cf31 Compare May 15, 2023 10:45
@konalegi
Copy link
Contributor

@TakuyaKurimoto Thanks for the PR! unfortunately I'm not familiar with the runtime mappings features, let me learn it and get back to you.

@TakuyaKurimoto
Copy link
Author

OK!
I'm sorry for bothering you.

@TakuyaKurimoto
Copy link
Author

@konalegi
sorry for bothering you. Any updates on that one?

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

Successfully merging this pull request may close these issues.

None yet

2 participants