Use geo_point data type on field in _reindex apiHow to modify or add a json field from logstash to work with geo_point in ElasticSearch and KibanaDealing with “null” fields and add_field directive in logstashCustom Analyzer for HaystackCreate a geo_point from two different fields in ElasticSearchELK - Kibana doesn't recognize geo_point fieldAWS Kinesis Firehose to ElasticSearch Geo data mappingencoding field as geo_point while writing DStream to Elastic searchgeo_point in ElasticElastic search 5.3 - failed to find geo_point fieldHow to map latitude and longitude values into a geo_point converting a database using the JDBC input plugin within Logstash to be used in Kibana?

merging certain list elements

Paradox regarding phase transitions in relativistic systems

What do you call the battery slot's ends?

How does the toothpaste end up back in the tube?

Can a business put a specific cancel-by date into a contract?

What is the maximum viable speed for a projectile within earth's atmosphere?

Paths Short or Long

What's the word for a student who doesn't register but goes to a class anyway?

Does Mage Hand give away the caster's position?

What is the word for a person who destroys monuments?

What exactly is a web font, and what does converting to one involve?

Can I separate garlic into cloves for storage?

Is it safe to unplug a blinking USB drive after 'safely' ejecting it?

How could artificial intelligence harm us?

Should I inform my future product owner that there is a good chance that a team member will leave the company soon?

How do you determine which representation of a function to use for Newton's method?

Talk about Grandpa's weird talk: Who are these folks?

Exam design: give maximum score per question or not?

Plausibility and performance of a composite longbow

What was the deeper meaning of Hermione wanting the cloak?

Does rpcpassword need to be non-obvious in bitcoind?

What the did the controller say during my approach to land (audio clip)?

Cemented carbide swords - worth it?

Delete empty subfolders, keep parent folder



Use geo_point data type on field in _reindex api


How to modify or add a json field from logstash to work with geo_point in ElasticSearch and KibanaDealing with “null” fields and add_field directive in logstashCustom Analyzer for HaystackCreate a geo_point from two different fields in ElasticSearchELK - Kibana doesn't recognize geo_point fieldAWS Kinesis Firehose to ElasticSearch Geo data mappingencoding field as geo_point while writing DStream to Elastic searchgeo_point in ElasticElastic search 5.3 - failed to find geo_point fieldHow to map latitude and longitude values into a geo_point converting a database using the JDBC input plugin within Logstash to be used in Kibana?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have index that contains two fields: longitude and latitude that are stored as float. I want to create new index and copy data from the first one but with different mappings. I use reindex api with elastic processors which can rename fields and give them different data types. When i try to create field with type "geo_point" it fails.



"type": "parse_exception",
"reason": "[type] type [geo_point] not supported, cannot convert field.",


but when i create new index i am able to create field with "geo_point" type.
i tried different workarounds but documentation says that with geo queries you can only use "geo_point" type.
is there any solution?




"description": "test pipe",
"processors": [

"convert":
"field": "location",
"type": "geo_point"


]



added pipe definition.










share|improve this question


























  • Please show your ingest pipeline definition

    – Val
    Mar 28 at 14:09











  • sorry for being so late:) added pipeline definition.

    – Taras Fityo
    Mar 29 at 10:27











  • Can you also show your mapping and a sample document, please?

    – Val
    Mar 29 at 10:34











  • Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

    – Taras Fityo
    Mar 29 at 10:48











  • Do you actually have a field called location? Can you show what the pipeline creation error is?

    – Val
    Mar 29 at 10:52

















0















I have index that contains two fields: longitude and latitude that are stored as float. I want to create new index and copy data from the first one but with different mappings. I use reindex api with elastic processors which can rename fields and give them different data types. When i try to create field with type "geo_point" it fails.



"type": "parse_exception",
"reason": "[type] type [geo_point] not supported, cannot convert field.",


but when i create new index i am able to create field with "geo_point" type.
i tried different workarounds but documentation says that with geo queries you can only use "geo_point" type.
is there any solution?




"description": "test pipe",
"processors": [

"convert":
"field": "location",
"type": "geo_point"


]



added pipe definition.










share|improve this question


























  • Please show your ingest pipeline definition

    – Val
    Mar 28 at 14:09











  • sorry for being so late:) added pipeline definition.

    – Taras Fityo
    Mar 29 at 10:27











  • Can you also show your mapping and a sample document, please?

    – Val
    Mar 29 at 10:34











  • Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

    – Taras Fityo
    Mar 29 at 10:48











  • Do you actually have a field called location? Can you show what the pipeline creation error is?

    – Val
    Mar 29 at 10:52













0












0








0








I have index that contains two fields: longitude and latitude that are stored as float. I want to create new index and copy data from the first one but with different mappings. I use reindex api with elastic processors which can rename fields and give them different data types. When i try to create field with type "geo_point" it fails.



"type": "parse_exception",
"reason": "[type] type [geo_point] not supported, cannot convert field.",


but when i create new index i am able to create field with "geo_point" type.
i tried different workarounds but documentation says that with geo queries you can only use "geo_point" type.
is there any solution?




"description": "test pipe",
"processors": [

"convert":
"field": "location",
"type": "geo_point"


]



added pipe definition.










share|improve this question
















I have index that contains two fields: longitude and latitude that are stored as float. I want to create new index and copy data from the first one but with different mappings. I use reindex api with elastic processors which can rename fields and give them different data types. When i try to create field with type "geo_point" it fails.



"type": "parse_exception",
"reason": "[type] type [geo_point] not supported, cannot convert field.",


but when i create new index i am able to create field with "geo_point" type.
i tried different workarounds but documentation says that with geo queries you can only use "geo_point" type.
is there any solution?




"description": "test pipe",
"processors": [

"convert":
"field": "location",
"type": "geo_point"


]



added pipe definition.







elasticsearch kibana






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 29 at 10:26







Taras Fityo

















asked Mar 28 at 13:53









Taras FityoTaras Fityo

86 bronze badges




86 bronze badges















  • Please show your ingest pipeline definition

    – Val
    Mar 28 at 14:09











  • sorry for being so late:) added pipeline definition.

    – Taras Fityo
    Mar 29 at 10:27











  • Can you also show your mapping and a sample document, please?

    – Val
    Mar 29 at 10:34











  • Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

    – Taras Fityo
    Mar 29 at 10:48











  • Do you actually have a field called location? Can you show what the pipeline creation error is?

    – Val
    Mar 29 at 10:52

















  • Please show your ingest pipeline definition

    – Val
    Mar 28 at 14:09











  • sorry for being so late:) added pipeline definition.

    – Taras Fityo
    Mar 29 at 10:27











  • Can you also show your mapping and a sample document, please?

    – Val
    Mar 29 at 10:34











  • Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

    – Taras Fityo
    Mar 29 at 10:48











  • Do you actually have a field called location? Can you show what the pipeline creation error is?

    – Val
    Mar 29 at 10:52
















Please show your ingest pipeline definition

– Val
Mar 28 at 14:09





Please show your ingest pipeline definition

– Val
Mar 28 at 14:09













sorry for being so late:) added pipeline definition.

– Taras Fityo
Mar 29 at 10:27





sorry for being so late:) added pipeline definition.

– Taras Fityo
Mar 29 at 10:27













Can you also show your mapping and a sample document, please?

– Val
Mar 29 at 10:34





Can you also show your mapping and a sample document, please?

– Val
Mar 29 at 10:34













Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

– Taras Fityo
Mar 29 at 10:48





Basically the problem is that this pipe is not valid, kibana shows error, meaning that any field can not be converted to geo_point type. Error happens when i want to create this pipe.

– Taras Fityo
Mar 29 at 10:48













Do you actually have a field called location? Can you show what the pipeline creation error is?

– Val
Mar 29 at 10:52





Do you actually have a field called location? Can you show what the pipeline creation error is?

– Val
Mar 29 at 10:52












1 Answer
1






active

oldest

votes


















0
















OK, let's say that your current index mapping looks like this:



PUT oldindex

"mappings":
"doc":
"properties":
"latitude":
"type": "float"
,
"longitude":
"type": "float"







You need to create a new index with the proper mapping, as follows



PUT newindex

"mappings":
"doc":
"properties":
"location":
"type": "geo_point"







And then, you can simply leverage the reindex API to copy the old index into the new one with some additional scripting to create the location field:



POST _reindex

"source":
"index": "oldindex",
,
"dest":
"index": "newindex"
,
"script":
"source": "ctx._source.location = ['lat': ctx._source.latitude, 'lon': ctx._source.longitude]; ctx._source.remove('latitude'); ctx._source.remove('longitude'); "




And you're good to go with the location field in your new shiny index!






share|improve this answer

























  • Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

    – Taras Fityo
    Apr 1 at 9:37












  • any luck with this?

    – Val
    Apr 1 at 9:38











  • updated my comment.

    – Taras Fityo
    Apr 1 at 9:40











  • which field?, if you create a new index, the field is properly mapped

    – Val
    Apr 1 at 9:46











  • Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

    – Taras Fityo
    Apr 1 at 14:15










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399327%2fuse-geo-point-data-type-on-field-in-reindex-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















OK, let's say that your current index mapping looks like this:



PUT oldindex

"mappings":
"doc":
"properties":
"latitude":
"type": "float"
,
"longitude":
"type": "float"







You need to create a new index with the proper mapping, as follows



PUT newindex

"mappings":
"doc":
"properties":
"location":
"type": "geo_point"







And then, you can simply leverage the reindex API to copy the old index into the new one with some additional scripting to create the location field:



POST _reindex

"source":
"index": "oldindex",
,
"dest":
"index": "newindex"
,
"script":
"source": "ctx._source.location = ['lat': ctx._source.latitude, 'lon': ctx._source.longitude]; ctx._source.remove('latitude'); ctx._source.remove('longitude'); "




And you're good to go with the location field in your new shiny index!






share|improve this answer

























  • Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

    – Taras Fityo
    Apr 1 at 9:37












  • any luck with this?

    – Val
    Apr 1 at 9:38











  • updated my comment.

    – Taras Fityo
    Apr 1 at 9:40











  • which field?, if you create a new index, the field is properly mapped

    – Val
    Apr 1 at 9:46











  • Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

    – Taras Fityo
    Apr 1 at 14:15















0
















OK, let's say that your current index mapping looks like this:



PUT oldindex

"mappings":
"doc":
"properties":
"latitude":
"type": "float"
,
"longitude":
"type": "float"







You need to create a new index with the proper mapping, as follows



PUT newindex

"mappings":
"doc":
"properties":
"location":
"type": "geo_point"







And then, you can simply leverage the reindex API to copy the old index into the new one with some additional scripting to create the location field:



POST _reindex

"source":
"index": "oldindex",
,
"dest":
"index": "newindex"
,
"script":
"source": "ctx._source.location = ['lat': ctx._source.latitude, 'lon': ctx._source.longitude]; ctx._source.remove('latitude'); ctx._source.remove('longitude'); "




And you're good to go with the location field in your new shiny index!






share|improve this answer

























  • Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

    – Taras Fityo
    Apr 1 at 9:37












  • any luck with this?

    – Val
    Apr 1 at 9:38











  • updated my comment.

    – Taras Fityo
    Apr 1 at 9:40











  • which field?, if you create a new index, the field is properly mapped

    – Val
    Apr 1 at 9:46











  • Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

    – Taras Fityo
    Apr 1 at 14:15













0














0










0









OK, let's say that your current index mapping looks like this:



PUT oldindex

"mappings":
"doc":
"properties":
"latitude":
"type": "float"
,
"longitude":
"type": "float"







You need to create a new index with the proper mapping, as follows



PUT newindex

"mappings":
"doc":
"properties":
"location":
"type": "geo_point"







And then, you can simply leverage the reindex API to copy the old index into the new one with some additional scripting to create the location field:



POST _reindex

"source":
"index": "oldindex",
,
"dest":
"index": "newindex"
,
"script":
"source": "ctx._source.location = ['lat': ctx._source.latitude, 'lon': ctx._source.longitude]; ctx._source.remove('latitude'); ctx._source.remove('longitude'); "




And you're good to go with the location field in your new shiny index!






share|improve this answer













OK, let's say that your current index mapping looks like this:



PUT oldindex

"mappings":
"doc":
"properties":
"latitude":
"type": "float"
,
"longitude":
"type": "float"







You need to create a new index with the proper mapping, as follows



PUT newindex

"mappings":
"doc":
"properties":
"location":
"type": "geo_point"







And then, you can simply leverage the reindex API to copy the old index into the new one with some additional scripting to create the location field:



POST _reindex

"source":
"index": "oldindex",
,
"dest":
"index": "newindex"
,
"script":
"source": "ctx._source.location = ['lat': ctx._source.latitude, 'lon': ctx._source.longitude]; ctx._source.remove('latitude'); ctx._source.remove('longitude'); "




And you're good to go with the location field in your new shiny index!







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 29 at 15:13









ValVal

120k6 gold badges174 silver badges201 bronze badges




120k6 gold badges174 silver badges201 bronze badges















  • Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

    – Taras Fityo
    Apr 1 at 9:37












  • any luck with this?

    – Val
    Apr 1 at 9:38











  • updated my comment.

    – Taras Fityo
    Apr 1 at 9:40











  • which field?, if you create a new index, the field is properly mapped

    – Val
    Apr 1 at 9:46











  • Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

    – Taras Fityo
    Apr 1 at 14:15

















  • Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

    – Taras Fityo
    Apr 1 at 9:37












  • any luck with this?

    – Val
    Apr 1 at 9:38











  • updated my comment.

    – Taras Fityo
    Apr 1 at 9:40











  • which field?, if you create a new index, the field is properly mapped

    – Val
    Apr 1 at 9:46











  • Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

    – Taras Fityo
    Apr 1 at 14:15
















Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

– Taras Fityo
Apr 1 at 9:37






Thanks for a comment!The problem is that i cannot execute geo queries on this field, elastic says that it's not geo_point data type.

– Taras Fityo
Apr 1 at 9:37














any luck with this?

– Val
Apr 1 at 9:38





any luck with this?

– Val
Apr 1 at 9:38













updated my comment.

– Taras Fityo
Apr 1 at 9:40





updated my comment.

– Taras Fityo
Apr 1 at 9:40













which field?, if you create a new index, the field is properly mapped

– Val
Apr 1 at 9:46





which field?, if you create a new index, the field is properly mapped

– Val
Apr 1 at 9:46













Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

– Taras Fityo
Apr 1 at 14:15





Thank you for help man.It was right solution.Sorry for answering with such big intervals.!)

– Taras Fityo
Apr 1 at 14:15








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399327%2fuse-geo-point-data-type-on-field-in-reindex-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript