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

feat: Add support for runtime_mapping #165

Closed
wants to merge 1 commit into from

Conversation

jmaitrehenry
Copy link
Contributor

Fix #152

Add the support for runtime_mapping like:

const field = esb.runtimeField(
      'keyword',
      `emit(doc['sessionId'].value + '::' + doc['name'].value)`,
);
const reqBody = esb.requestBodySearch();
reqBody.runtimeMapping('sessionId-eventName', field);

This will generate a query like that:

{
  "runtime_mappings": {
    "sessionId-eventName": {
      "type": "keyword",
      "script": {
        "source": "emit(doc['sessionId'].value + '::' + doc['name'].value)"
      }
    }
  }
}

…eld() and esb.requestBodySearch().runtimeFields()
@jmaitrehenry jmaitrehenry changed the title Add support for runtime_mapping feat: Add support for runtime_mapping Oct 25, 2022
@sudo-suhas
Copy link
Owner

will try to check this during the weekend. Thanks @jmaitrehenry for the PR.

'lookup'
];

class RuntimeField {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add doc comments for the class and it's methods? You can check any other file for reference.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please add a note here mentioning that this feature was added to Elasticsearch in v7.11?

@@ -406,6 +406,74 @@ class RequestBodySearch {
return this;
}

/**
* Computes a document property dynamically based on the supplied `script`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a note here mentioning that this feature was added to Elasticsearch in v7.11?

'lookup'
];

class RuntimeField {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please add a note here mentioning that this feature was added to Elasticsearch in v7.11?

@jmaitrehenry
Copy link
Contributor Author

Thanks for the review @sudo-suhas, I will try to update it in the next few days.

@sudo-suhas
Copy link
Owner

ping @jmaitrehenry

@pimpelsang
Copy link

please finish it :)

@atreids
Copy link
Contributor

atreids commented Feb 28, 2024

Hi, I've raised a separate pull request based on @jmaitrehenry 's work to try and get this feature merged. @sudo-suhas If you have some time to review, that would be greatly appreciated.

@sudo-suhas sudo-suhas closed this Mar 3, 2024
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.

Support to runtime_mappings
4 participants