Kibana is unable to parse Bettermap with the following error:
Error: Invalid LatLng object: (undefined, [-95.416,29.7346])
I'm passing the longitude/latitude as:
"location":"[-95.416,29.7346]"}
What specifically is being referenced as undefined?
The input is wrong, you should provide and array (so loose the quotes around the array. It can also be a string, than you have to loose the [ and ]. Also be careful with the order of longitude and latitude, they differ for the string and array based types. You can find more about the input formats here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html
Also check if the field location is of type geo_point.
Related
I have the following case:
I have some information stored in Neo4j. One property store a JSON document, and I would like to get the information inside this JSON document.
I have retrieved the data, even the JSON field using MATCH:
MATCH (n:Node) RETURN n.id, n.nodeInfo as JSONInfo
JSONInfo (which is a property of Node), has the JSON Information:
{
"TIMESTAMP":"2018-03-11T04:58:24Z",
"field1":"358716053191804",
"field2":"732111149743974",
"version_field", "3.9.1"
"field3":"0",
"field4":"0"
}
But, I just want to get field1, that has inside JSON property.
What is the best way to retrieve this field in the MATCH command?
Thanks in advance
First of all your example isn't valid JSON. Your version_field key and value should be separated by a colon, not a comma, and you need a comma after "3.9.1".
{ "TIMESTAMP":"2018-03-11T04:58:24Z", "field1":"358716053191804", "field2":"732111149743974", "version_field":"3.9.1", "field3":"0", "field4":"0" }
Once that's fixed, and the field is valid JSON, you can use JSON conversion functions from APOC Procedures to do the conversion from a JSON object to a map, then just use dot notation to access map properties:
MATCH (n:Node)
RETURN apoc.convert.fromJsonMap(n.nodeInfo).field1 as field1
Keep in mind that map properties in JSON map strings cannot be indexed, so the data within your JSON string property should be used for storage and retrieval, not for lookup.
I have a list of U.S. states where duplicate values are also available. I need to find how many unique states are there in a list.
'Unique' function returns all the unique states but in conjunction with 'query' function the following error message is returned:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: A
=query(unique(A3:A26),"Select count(A)")
What am I doing wrong?
Having reconstructed the data (after UNIQUE it is different) you can't then continue with letters for column references. So:
=query(unique(A3:A26),"Select count(Col1)")
I am trying to get tweets with either the word "python" in it or the ones that are around my city
This is my code:
StatusListener listener = new MyStatusListener(twitter);
twitterStream.addListener(listener);
FilterQuery query = new FilterQuery();
String[] arr = { "python" };
double lat = 18.5203;
double lon = 73.8567;
double[][] locations = { { lat, lon } }; // for Pune city
query.track(arr);
query.locations(locations);
twitterStream.filter(query);
When I run this I get following exception:
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#405ef8c2
[Thu Jun 26 19:06:58 GMT+05:30 2014]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;#405ef8c2
I get the same message in pair. If I remove the locations condition, the code works fine. I am not sure what the issue is here. Can someone help please?
That was my bad. I was assuming that if I dont provide a pair, twitter will assume a radius (like it does on web UI- near a city). But I guess you have to provide a bounding box. Giving a bounding box worked for me.
When I add:
fields: [ "doc['Location'].lon" ]
to my query, the longitude value is different that what is shown in the document source.
Here you can see the results of a query where I fetched the doc['Latitude'].lon and .lat, and the _source.Latitude to compare:
https://gist.github.com/d9533170f1f50fd27e87 (note - these have been passed through json_decode in PHP, but the data is the same before using json_decode.)
I first noticed this when I was using "doc['field_name'].distance(lat, lon)" to try and add the distance as a field to my query. I tried both the "script_fields" and "fields" keys and each had the same result.
UPDATE: I noticed that the "doc['Location'].lon" is returning what I thought should be the doc['Location'].lat (the lat and lon are switched.)
The problem was that when using GeoJSON format (or using lat/long as an array) you have to switch the order of lat/lng to lng/lat.
I am rebuilding my index, but, in order to work around this I have used this query for now:
doc['Location'].distance( lon + 180, lat ) // Temporary bandaid
Once I've rebuilt the index with the correct values I'll switch back to:
doc['field_name'].distance(lat, lon) // The correct method
I have rails application, which deals with some google map related stuff.the problem is , i have a table which contains latitude & longitude columns. the column types are "float". for some occasions i need to generate the query by the following:
clients.find_all_by_lat_and_lng(latvalue,lngvalue).
I gave the correct & existing lat & lng values to fetch the database value. but i can get only Empty.
I tried with difference dynamic finders like find_by_lat,find_by_lng i get only empty values from the query ...but data are exits in the table.
I guess the Float column type is the culprit here, i don't how to overcome this and get the values. Can one suggest me on this.
NOTE : if i work with same query in windows i get the values. my box is ubuntu here i can't get the values
clients.find(:all, :conditions => ["lat = ? and lng = ?",latvalue, lngvalue])
try this your model name is "clients" ???
or Client