Search exact words in elastichsearch

Using elasticseach, I want to search all documents with two words. I use: { "query": { "match": { "text": "word1 word2" } } } but instead of having documents with word1 and word2, i have documents with word1 or word2. ┬┐how can i search docs with word1 AND word2? >Solution : You can use operator… Read More Search exact words in elastichsearch

ElasticSearch new Java API print created quesy

I trying out the new Java Client for Elastic 8.1.1. In older versions i was able to print out the generated json query by using searchRequest.source(). I cannot find out actuallay what methode/service i can use do to so with the new client. My code looks: final Query range_query = new Query.Builder().range(r -> r.field("pixel_x") .from(String.valueOf(lookupDto.getPixel_x_min())).to(String.valueOf(lookupDto.getPixel_x_max())))… Read More ElasticSearch new Java API print created quesy

How to write Elasticsearch query to match specific field?

Hello I have an Elasticsearch instance (8.5.3) on cloud. One of the sample log entry is { "_index": ".ds-logs-elastic_agent-default-2022", "_id": "oc_PEIUBM9Mtr", "_score": "null", "_source": { "agent": { "name": "L51", "id": "df5fe808-af86", "ephemeral_id": "1a26250c-3c20", "type": "filebeat", "version": "8.5.2" }, "log": { "file": { "path": "C:\\Program Files\\Elastic\\Agent\\data\\elastic-agent-c13f91\\logs\\elastic-agent-20221208-3.ndjson" }, "offset": 210000 }, "elastic_agent": { "id": "df5fe808-af8", "version": "8.5.2",… Read More How to write Elasticsearch query to match specific field?

Need help to understand the difference between GET /_index_template/<template name> and GET _cat/templates?v output

In elastic _cat/templates?v output, I see two templates: "1": { "name": "flowlogtmplt", "index_patterns": "[flowlog*, flowobsrv*]", "order": "0", "version": null, "composed_of": "" }, "14": { "name": "flowlog", "index_patterns": "[flowlog-*]", "order": "0", "version": null, "composed_of": "[]" }, However, when I try to check the template name using GET /_index_template/, only "flowlog" returns a result but "flowlogtmplt" returns… Read More Need help to understand the difference between GET /_index_template/<template name> and GET _cat/templates?v output

Regex query not works in EleasticSearch but works in java

The Regex works in java but is not woked in ElasticSearch. Java: Pattern pattern = Pattern.compile("(\\d{8}-[01],)*(((202210((2[89])|(3[01])))|(2022((1[12]))\\d{2})|(20((2[3-9])|([3-9][0-9]))\\d{4}))-[01])*([,]\\d{8}-[01])*"); Matcher matcher = pattern.matcher("20221027-0,20221028-1"); System.out.println(matcher.matches()); It prints true But when I using EleasticSearch, it was not woked. The folloing json is the document what I want to query in EleasticSearch. { "_index": "eagle_clue_v1", "_type": "_doc", "_id": "51740", "_score": 0.0,… Read More Regex query not works in EleasticSearch but works in java