0

I want to enable both numberic and full-text search for a field.

I need the two ways to search the field for different scenarios.

How can I index the field?

1 Answer 1

2

You can always make use of fields for such use cases. Lets say the field name is field1. Below is how you can define it for indexing it in different ways:

   "field1": {
      "type": "integer",
      "fields": {
        "textval": {
          "type": "text"
        },
        "keyword": {
          "type": "keyword"
        }
      }
    }

Refer this for understanding more on fields.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Nishant! What if I want to add another type "keyword" for aggregation? That is, it should have different types: integer, text, and keyword. I searched through multi-fields examples in ES but can only find at most 2 types.
Updated my answer for the same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.