How to index the ip address of long type

hi, I want to index the data that has a ip address field stored as long. when i index the data with a ip type mapping, it says "mapper_parsing_exception", when i index it with a long type mapping, it cannot be query with ip. How can i deal with it and i can query with ip address

Hi, you need to convert long to ip-address proir indexing if you want to use ip type.

Thanks to @rusty. Why it cannot be converted automatically? This is inconvenient.

You can create a feature request on github to extend ip-type mapper with ability to use long value as ip address.
Another way is scripting someting like this solution.

@rusty thanks a lot. I am very intersted in elasticsearch community, but now i don't know how to create a feature request on github. I willl try my best to learn it and make contribution to the community.