Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
liowalter committed Sep 7, 2024
1 parent 5e6a479 commit 8aebf57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ chmod g+rwx kibanadata
sudo chgrp 0 esdata01
sudo chgrp 0 esdata02
sudo chgrp 0 kibanadata
```

Go to kibana :
```
10 changes: 3 additions & 7 deletions api/app/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,16 @@ def search_documents(self, longitude: float, latitude: float, radius: str) -> li
}
}
],
"script_fields": {
"distance_in_m": {
"script": f"doc['coordinates'].arcDistance({latitude}, {longitude})"
}
},
"_source": ["*"]
"script_fields": {"distance_in_m": {"script": f"doc['coordinates'].arcDistance({latitude}, {longitude})"}},
"_source": ["*"],
}
)
hits = response["hits"]["hits"]

source_fields = list(map(itemgetter("_source"), hits))
scripted_fields = list(map(itemgetter("fields"), hits))

return list(map(lambda thing: {**thing.get("_source"), 'distance': thing.get("fields")["distance_in_m"][0]}, hits))
return list(map(lambda thing: {**thing.get("_source"), "distance": thing.get("fields")["distance_in_m"][0]}, hits))

def search(self, query: dict) -> ObjectApiResponse:
"""Search for documents in the index, returning the elastic search response."""
Expand Down

0 comments on commit 8aebf57

Please sign in to comment.