-
Error:
ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]] -
Solution/Reason: Fielddata was disabled
-
Caution: The solution isn't always to turn on fielddata since turning it on will increase the memory consumption by ES (because it creates an inverted index) instead append
.keywordto the field name as a workaround. -
Text fields: These are analyzed fields that can be used for full-text search (exact matches are not needed and docs can be searched using tokens)
-
Keyword fields: These are non-analyzed fields that are used for keyword search (need exact matches to return docs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is an example of using elastic's BulkProcessor with Elasticsearch. | |
| // | |
| // See https://github.com/olivere/elastic and | |
| // and https://github.com/olivere/elastic/wiki/BulkProcessor | |
| // for more details. | |
| /* | |
| * This example illustrates a simple process that performs bulk processing | |
| * with Elasticsearch using the BulkProcessor in elastic. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_source": ["_id"], | |
| "from": 1, | |
| "size": 10, | |
| "query": { | |
| "bool": { | |
| "filter": [{ | |
| "bool": { | |
| "should": { | |
| "bool": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "organizationId": "atlan", | |
| "order": "asc", | |
| "allFormsFLag": true, | |
| "formId": "hHhcLKh9st1vFr8nDY4a", | |
| "dateField": "_created_at", | |
| "startDate": "2019-05-20", | |
| "endDate": "2019-05-21", | |
| "userId": [ | |
| "gTOAbrbVUkPXgZYNXz2n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "reflect" | |
| elastic "gopkg.in/olivere/elastic.v3" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query": { | |
| "bool": { | |
| "filter": [{ | |
| "match": { | |
| "client": "android" | |
| } | |
| }, { | |
| "match": { | |
| "isActive": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "took" : 1, | |
| "timed_out" : false, | |
| "_shards" : { | |
| "total" : 1, | |
| "successful" : 1, | |
| "skipped" : 0, | |
| "failed" : 0 | |
| }, | |
| "hits" : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {\"bool\":{\"filter\":{\"FormMatch\":null,\"IsActiveMatch\":null,\"ClientMatch\":null,\"DateRangeMatch\":null,\"UserIdArrayMatch\":null}}}" | |
| {'size': 0, 'query': {'bool': {'filter': [{'match': {'formId': '324fds'}}, {'match': {'isActive': True}}, {'match': {'client': 'android'}}, {'range': {'fff': {'gte': 'fff', 'lte': 'fff'}}}, {'terms': {'_p_createdBy': ['_User$d', '_User$f', '_User$s', '_User$f', '_User$d']}}]}}, 'aggs': {'responses_over_time': {'date_histogram': {'field': 'fdsf', 'interval': 'dsfsdf'}}}} | |
| {'bool': {'filter': [{'match': {'formId': '324fds'}}, {'match': {'isActive': True}}, {'match': {'client': 'android'}}, {'range': {'fff': {'gte': 'fff', 'lte': 'fff'}}} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "response_v2_862875ee3a88a6d09c95bdbda029ce2b" : { | |
| "aliases" : { }, | |
| "mappings" : { | |
| "properties" : { | |
| "_created_at" : { | |
| "type" : "date" | |
| }, | |
| "_p_createdBy" : { | |
| "type" : "text", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create_filter_pipeline(body): | |
| "Creates pipeline of filters based on the global filters present on the dashboard" | |
| form_id = body.get("formId") | |
| start_date = body.get("startDate") | |
| end_date = body.get("endDate") | |
| date_field = body.get("dateField", "_created_at") | |
| user_id_array = body.get("userId") | |
| filter_pipeline = [] |