Skip to content

Commit

Permalink
Various additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannis Frangos committed Dec 6, 2022
1 parent 8b0ccde commit 0d55fbe
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea
*.iml
*.swp
.DS_Store
16 changes: 13 additions & 3 deletions apps/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ https://hub.docker.com/_/elasticsearch/

To ensure that you do not run into conflicts, it is advisable to ensure that fields with the same name are mapped in the same way in every type in an index.

Although you can add to an existing mapping, you cant change existing field mappings. If a mapping already exists for a field, data from that field has probably been indexed. If you were to change the field mapping, the indexed data would be wrong and would not be properly searchable.
Although you can add to an existing mapping, you cant change existing field mappings. If a mapping already exists for a field, data from that field has probably been indexed. If you were to change the field mapping, the indexed data would be wrong and would not be properly searchable.

### View mapping
GET /gb/_mapping/tweet
Expand Down Expand Up @@ -35,7 +35,7 @@ It is often useful to index the same field in different ways for different purpo
* The full document is available directly from the search results need for a separate round-trip to fetch the document from another data store.
* Partial update requests will not function without the _source field.
* When your mapping changes and you need to reindex your data, you can do so directly from Elasticsearch instead of having to retrieve all of your documents from another (usually slower) data store.
* Individual fields can be extracted from the _source field and returned in get or search requests when you dont need to see the whole document.
* Individual fields can be extracted from the _source field and returned in get or search requests when you dont need to see the whole document.
* It is easier to debug queries, because you can see exactly what each document contains, rather than having to guess their contents from a list of IDs.

In Elasticsearch, setting individual document fields to be stored is usually a false optimization. The whole document is already stored as the _source field. It is almost always better to just extract the fields that you need by using the _source parameter.
Expand All @@ -50,4 +50,14 @@ Inclusion in the _all field can be controlled on a field-by-field basis by using
Remember that the _all field is just an analyzed string field. It uses the default analyzer to analyze its values, regardless of which analyzer has been set on the fields where the values originate. And like any string field, you can configure which analyzer the _all field should use:

## Reindex
To reindex all of the documents from the old index efficiently, use scroll to retrieve batches of documents from the old index, and the bulk API to push them into the new index.
To reindex all of the documents from the old index efficiently, use scroll to retrieve batches of documents from the old index, and the bulk API to push them into the new index.

## SPECIAL CASES TO CONSIDER

### On `should`

The should clause of the bool query is for optional search criteria. Let's say you are looking for hotels and would prefer for the hotel to have a swimming pool, but you would also like to see hotels without a swimming pool in the search results, then the query for swimming pool would be in the should clause. Elasticsearch will give the documents that match more should queries a higher score, so those documents will be ranked higher in the search results.

When you only have a should clause, then at least one of the should clauses must match for a document to be considered a hit.

When you combine a should clause with a filter than all should clauses are optional, so even documents that only match the filter will be returned. You can change that behavior by setting minimum_should_match on the bool query. You could set that for example to 1 to make it mandatory for at least one should clause to match. The docs have an example of that: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
18 changes: 18 additions & 0 deletions raspberry/no_radios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Disable radios

You might want to disable totally the radios from your raspeberry (wifi, bluetooth), to reduce consumption and possible interference.

## Using rfkill

sudo rfkill block wifi

## Modifying boot

Edit `/boot/config.txt`, and in `[all]' add the following:

dtoverlay=disable-wifi
dtoverlay=disable-bt

## Resource

* https://pimylifeup.com/raspberry-pi-disable-wifi/
19 changes: 19 additions & 0 deletions ubiquiti/erx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ERX

## Update `config.boot` manually

1. Copy `/config/config.boot` to e.g. `/config/updated.config.boot`
2. Perform any changes you might want to `/config/updated.config.boot`
3. Load, review and persist the updated configuration like so:
1. `load updated.config.boot`
2. `compare`
3. `commit`
4. `save`
5. `exit`

## Wireguard and firmware upgrades

When EdgeOS updates its firmware it loses the wireguard installation and any wireguard configuration that might be `disabled`. Thus, before updating, ensure all wireguard configuration is enabled, or else you will have to restore it manually from previous backups.



0 comments on commit 0d55fbe

Please sign in to comment.