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 3 times, most recently from 6a7cf31 to 3a81990 Compare May 15, 2023 16:09
@konalegi
Copy link

@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?

@konalegi
Copy link

konalegi commented Oct 8, 2024

@TakuyaKurimoto Sorry, was extremely busy. Is this PR still relevant?

@TakuyaKurimoto
Copy link
Author

@konalegi
Thanks for getting back to me. The problem is still there, so I'd appreciate it if you could apply this patch.

@konalegi
Copy link

konalegi commented Oct 8, 2024

Cool, can you rebase and push latest changes so I can run CI?

@TakuyaKurimoto TakuyaKurimoto requested a review from a team as a code owner October 8, 2024 14:18
@TakuyaKurimoto
Copy link
Author

TakuyaKurimoto commented Oct 8, 2024

@konalegi
rebased! Please run CI.

@konalegi
Copy link

konalegi commented Oct 8, 2024

Everything is passing, let me get familiar with the topic, and I'll merge it.

@TakuyaKurimoto
Copy link
Author

Thank you!

@konalegi
Copy link

konalegi commented Oct 9, 2024

@TakuyaKurimoto looks good 👍 Although could you please add a couple of lines into documentation about this feature, no extensive doc is needed, just an example + reference to elastic doc, so people know that this feature exists.
Thanks!

@TakuyaKurimoto
Copy link
Author

@konalegi
Sorry, but which file are you referring to when you say "documentation"? Is it CHANGELOG.md?

@konalegi
Copy link

konalegi commented Oct 9, 2024

@TakuyaKurimoto Actually I'm about README.md

@TakuyaKurimoto
Copy link
Author

@konalegi
I understand. I've added the document, so please check it.

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.

2 participants