# Geo\_point not indexed in Array format

**URL:** https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334
**Category:** Logstash
**Created:** [April 22, 2020, 6:18pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334 "2020-04-22T18:18:20Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 22, 2020, 6:18pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/1 "2020-04-22T18:18:20Z")

</div>

Hi all,

I'm using logstash to index mongodb documents into ES. every thing goes well but the location object is not indexed. I defined a template mapping as geo\_point as follow :

```auto
      "arrival_in": {
        "ignore_malformed": true,
        "type": "geo_point",
        "ignore_z_value": true
      },

```

Here is the array object I want to index :

```auto
{...
    "arrival_in" : [ 
        10.1039266666667, 
        33.889845
    ],
...
}

```

nothing indexed in ES, but when I try to insert manually with dev console, every thing OK.  
Could you help please.  
Jalil

---

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 25, 2020, 12:10pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/2 "2020-04-25T12:10:22Z")

</div>

Any help please ?

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [April 26, 2020, 10:01pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/3 "2020-04-26T22:01:40Z")

</div>

Do you see any `ERROR` OR `WARN` in your Logstash log when you try to index the document? Is your time filter in Discover tab correctly set to show the time the document was set to indexed at?

---

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 27, 2020, 9:32am UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/4 "2020-04-27T09:32:42Z")

</div>

Time filter in discover is ok and I see my documents but without arrival\_in.

there is 4 WARN lines in log :

```auto
[2020-04-27T11:16:22,808][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
...
[2020-04-27T11:16:43,563][WARN][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=>"http://localhost:9200/"}
[2020-04-27T11:16:43,680][INFO][logstash.outputs.elasticsearch][main] ES Output version determined {:es_version=>7}
[2020-04-27T11:16:43,688][WARN][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>7}
[2020-04-27T11:16:43,762][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ParNew"}
[2020-04-27T11:16:43,776][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ConcurrentMarkSweep"}
[2020-04-27T11:16:43,805][INFO][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//localhost:9200"]}
[2020-04-27T11:16:43,968][WARN][org.logstash.instrument.metrics.gauge.LazyDelegatingGauge][main] A gauge metric of an unknown type (org.jruby.specialized.RubyArrayOneObject) has been create for key: cluster_uuids. This may result in invalid serialization. It is recommended to log an issue to the responsible developer/development team.

```

No ERROR line.  
thank you

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [April 27, 2020, 10:14am UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/5 "2020-04-27T10:14:11Z")

</div>

Ok, so doc is getting indexed but you don't see the field in the Discover tab?. Have you tried refreshing your index pattern in Kibana?

 ![Screen Shot 2020-04-27 at 6.10.34 AM](https://us1.discourse-cdn.com/elastic/original/3X/4/5/451fe2ddc45f72b6a885c637daa6e979873da417.png)

---

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 27, 2020, 10:25am UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/6 "2020-04-27T10:25:57Z")

</div>

Yes I did it every time I reindex or insert news documents.

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [April 27, 2020, 10:43am UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/7 "2020-04-27T10:43:07Z")

</div>

Ok, please paste the following:

1. Your logstash pipeline including the output Elasticsearch plugin that you are using for indexing
2. What is the index to which your mapping template is applied to?

---

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 27, 2020, 10:48am UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/8 "2020-04-27T10:48:25Z")

</div>

here is my logstash config :

```auto
# config pour intégrer des données mongodb dans ES

input{
  mongodb {
    uri => 'mongodb://localhost:27017/trips'
    placeholder_db_dir => 'C:\datadb\logstash-mongodb'
    placeholder_db_name => 'logstash_sqlite.db'
    collection => 'trip'
    batch_size => 5000
  }
}

filter{
	mutate {
		copy => { "_id" => "[@metadata][_id]"}
		remove_field => ["_id"]
	}
	
}

output{
elasticsearch {
	manage_template => "false"
    #document_type => "stop"
    #template_overwrite => "true"
    template_name=>"trip-template"
	hosts => ["localhost:9200"]
	index => "trip-3-%{+YYYY.MM.dd}"
	}
	stdout { codec => rubydebug }
}

```

and here is some examples of data :

```auto
[
	{
		"_id": {
			"$oid": "5e89cca6bf8ce1de0e13fa19"
		},
		"departure_at": {
			"$date": "2019-03-18T14:27:46Z"
		},
		"departure_place": null,
		"departure_city": "Tina",
		"distance": 119,
		"duration": 13231,
		"fuel_consumption": null,
		"arrival_at": {
			"$date": "2019-03-18T18:08:17Z"
		},
		"arrival_in":[10.103926666666667,33.889845],
		"arrival_place": null,
		"arrival_city": "Gabes Medina"
	},
....
]

```

My template :

```auto
{
  "_doc": {
    "_meta": {},
    "_source": {},
    "properties": {
      "duration": {
        "type": "long"
      },
      "@timestamp": {
        "type": "date"
      },
      "distance": {
        "type": "long"
      },
      "arrival_city": {
        "type": "text",
        "fields": {
          "keyword": {
            "ignore_above": 256,
            "type": "keyword"
          }
        }
      },
      "departure_at": {
        "type": "date"
      },
      "departure_city": {
        "type": "text",
        "fields": {
          "keyword": {
            "ignore_above": 256,
            "type": "keyword"
          }
        }
      },
      "arrival_in": {
        "ignore_malformed": false,
        "type": "geo_point",
        "ignore_z_value": false
      },
      "arrival_at": {
        "type": "date"
      }
    }
  }
}

```

thank you in advance for your help 🙂

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [April 27, 2020, 12:19pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/9 "2020-04-27T12:19:06Z")

</div>

I ran your log over my Logstash docker and here are a few problems that I see:

1. Your response from your mongodb query is an `array` of JSON docs (from what I can see in your response). Your filter plugin does not address this. Assuming you want each of those JSON docs indexed as a separate doc in Elasticsearch, you need to loop over that array.

2. After you do 1, you need to use `json { source => "message" }`, this will make sure each JSON entry gets parsed as a JSON doc. This should let your `arrival_in` field get indexed as a `geo_point`.

3. Your `arrival_at` and `departure_at` are both nested json fields while your mappings expects them to be of type `date` so there is clear conflict there. You need to pull those fields out and bring them to the root. Here is the error I got when I tried to index it.

l`ogstash | [2020-04-27T12:14:32,277][WARN][logstash.outputs.elasticsearch][main] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"trip-3-2020.04.27", :routing=>nil, :_type=>"_doc"}, #<LogStash::Event:0x512dda17>], :response=>{"index"=>{"_index"=>"trip-3-2020.04.27", "_type"=>"_doc", "_id"=>"JLyPu3EBaCCXfMYpcRQ4", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [arrival_at] of type [date] in document with id 'JLyPu3EBaCCXfMYpcRQ4'. Preview of field's value: '{$date=2019-03-18T18:08:17Z}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:45"}}}}}`

---

<div class="post-metadata">

### Author: ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)
#### Post date: [April 27, 2020, 12:33pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/10 "2020-04-27T12:33:07Z")

</div>

Thank you again, I can do that and loop over my array, but how can you explain why all other field are well mapped (text, string and number fields) but not the GPS coordinates one.

I think that eLogstash and ES consider them as separate doc because I get the right number of doc in ES after logstash finishing his processing (647 doc indexed), the right doc count.

I tested it manuelly, I mean I inserted one of those doc using dev console of kibana and it works well and arrival\_in is recognized as geo\_point.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 25, 2020, 12:33pm UTC](https://discuss.elastic.co/t/geo-point-not-indexed-in-array-format/229334/11 "2020-05-25T12:33:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
