2

A team I am working with has a lot of dirty data. Sometimes a field might be a string, sometimes an integer for a particular field in several related Mongo collections. When it's a string, we can always rely on it being a valid integer, so these two work just fine:

PUT index/1
{
    "field": 1
}

PUT index/2
{
    "field": "2"
}

However, the _source field in the latter returns "field" as a string. Cleaning up the source data is not an option for me because it's outside of my authority. So is there a way to have ElasticSearch return "field" consistently as an integer or am I always going to be stuck with getting it back as whatever form it was indexed (integer or string)?

1 Answer 1

3

If you're using ES 5+, you can use an ingest node, and an ingest pipeline which includes a convert processor.

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

1 Comment

I couldn't find anything else, so I'm going to go with this.

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.