# Country/location based data in twitter

**URL:** <https://discuss.elastic.co/t/country-location-based-data-in-twitter/181560>\
**Category:** Logstash\
**Created:** [May 17, 2019, 9:42am UTC](https://discuss.elastic.co/t/country-location-based-data-in-twitter/181560 "2019-05-17T09:42:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pathri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pathri/32/54484_2.png) [@pathri](https://discuss.elastic.co/u/pathri)\
**Post date:** [May 17, 2019, 9:42am UTC](https://discuss.elastic.co/t/country-location-based-data-in-twitter/181560/1 "2019-05-17T09:42:56Z")

</div>

Hi,

i am fetching data from twitter and wants to put a geo-location filter while fetching the data.  
tried  
country\_code = ["US","IN"]  
and location =["us"] but no luck  
please help.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [May 17, 2019, 10:20am UTC](https://discuss.elastic.co/t/country-location-based-data-in-twitter/181560/2 "2019-05-17T10:20:36Z")

</div>

How do you fetch the data from twitter?  
Using input plugin?

If you are using the twitter input plugin try this:

```
input {
twitter {
----your options
full_tweet => true
ignore_retweets => false
use_samples => false
languages => ["us"]

```

locations =\> "100,100"  
}  
}

#### `locations` [edit](https://github.com/logstash-plugins/logstash-input-twitter/edit/master/docs/index.asciidoc)

- Value type is [string](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html#string)
- There is no default value for this setting.

A comma-separated list of longitude, latitude pairs specifying a set of bounding boxes to filter tweets by. See [https://dev.twitter.com/streaming/overview/request-parameters#locations](https://dev.twitter.com/streaming/overview/request-parameters#locations) for more details.

> **[Consuming streaming data](https://developer.twitter.com/en/docs/tutorials/consuming-streaming-data#locations)**
>
> Tips for consuming streaming data.

you would have to handle it in a json filtering I guess going after the  
{  
"country": "Sweden",  
" **countryCode**": "SE",  
"name": "Sweden",  
"parentid": 1,  
"placeType": {  
"code": 12,  
"name": "Country"  
},  
"url": "[http://where.yahooapis.com/v1/place/23424954](http://where.yahooapis.com/v1/place/23424954)",  
"woeid": 23424954  
},

---

<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:** [June 14, 2019, 10:20am UTC](https://discuss.elastic.co/t/country-location-based-data-in-twitter/181560/3 "2019-06-14T10:20:37Z")

</div>

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