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

[FEATURE] Support search for fields in text #1113

Open
Yury-Fridlyand opened this issue Nov 26, 2022 · 0 comments
Open

[FEATURE] Support search for fields in text #1113

Yury-Fridlyand opened this issue Nov 26, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Yury-Fridlyand
Copy link
Collaborator

Is your feature request related to a problem?

/**
* Convert multi-field text field name to its inner keyword field. The limitation and assumption
* is that the keyword field name is always "keyword" which is true by default.
*
* @param fieldName field name
* @param fieldType field type
* @return keyword field name for multi-field, otherwise original field name returned
*/
protected String convertTextToKeyword(String fieldName, ExprType fieldType) {
if (fieldType == OPENSEARCH_TEXT_KEYWORD) {
return fieldName + ".keyword";
}
return fieldName;
}

/**
* Text field doesn't have doc value (exception thrown even when you call "get")
* Limitation: assume inner field name is always "keyword".
*/
public static String convertTextToKeyword(String fieldName, ExprType fieldType) {
if (fieldType == OPENSEARCH_TEXT_KEYWORD) {
return fieldName + ".keyword";
}
return fieldName;
}

  1. convertTextToKeyword is not used everywhere (e.g. relevance search functions);
  2. fields property could has any name;
  3. There are 2 duplicate functions.
{
  "mappings": {
    "properties": {
      "motto": {
        "type": "text",
        "fields": {
          "words": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}

What solution would you like?

Use mapping info to properly set fields name - words in the given sample.

What alternatives have you considered?

Add limitation section to documentation and return error on querying such kind of fields (aka columns).

Do you have any additional context?

Related to #794, #1038 and #1112.

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

No branches or pull requests

1 participant