Elastic Search Notes

Paginate in Search, use from and size.  Default is top 10 searches if size is not specified.  By default, you cannot use from and size to page through more than 10,000 hits.

GET /_search
{
  "from": 5,
  "size": 20,
  "query": {
    "match": {
      "user.id": "kimchy"
    }
  }
}

To return a selected field, use _source.

{
  "size": 20,  
  "query": {
        "bool": {
            "must": [
                 {
                "match": {
                    "Type": "TEST"
                 }
                }
            ],
            "filter": [
                {
                    "range": {
                        "DateCreated": {
                            "gte": "2021-12-15T00:00:00.000Z",
                            "lte": "2021-12-15T23:59:59.999Z"
                        }
                    }
                }
            ]
        }
    },
   "_source": ["SelectID"]
}

Reindex elastic search with zero down time (index alias)

https://logz.io/blog/managing-elasticsearch-indices/

Indexing best practice

Create Index Alias

Nodejs client library examples

invalid_type_name_exception error: explicitly specify api version