How do we query Elastic Search when there is a JSON object inside a nested type?

Advertisements My mapping looks like: { "mappings": { "dynamic": "strict", "_meta": { "version": 9 }, "properties": { "__myVersion": { "type": "integer" }, "businessKey": { "type": "keyword" }, "businessStatus": { "type": "keyword" }, "candidateGroups": { "type": "keyword" }, "definitionCategory": { "type": "keyword" }, "definitionId": { "type": "keyword" }, "definitionKey": { "type": "keyword" }, "definitionName": { "type":… Read More How do we query Elastic Search when there is a JSON object inside a nested type?

How To Filter Out List of Word from ElasticSearch Query Result?

Advertisements context.analyzer("email_indexing_exact") .custom() .tokenizer("uax_url_email"); SearchSession searchSession = Search.session(entityManager); String[] fieldsArray = {"displayName", "email"}; String[] filterEmailArray = filterEmail.split(","); var query = searchSession.search(User.class) .extension(ElasticsearchExtension.get()) .select(ElasticsearchSearchProjectionFactory::source) .where(f -> f.bool() .must(f.match().fields(fieldsArray).matching(word).analyzer("autocomplete_search")) .mustNot(f.match().field("email").matching(filterEmailArray[0]).analyzer("email_indexing_exact")) ) .sort(f -> f.score().desc()); As you can see I only can filter out the 0th index of the array. How to filter out all of them? >Solution… Read More How To Filter Out List of Word from ElasticSearch Query Result?

How to write Elasticsearch query to match specific field?

Advertisements 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":… 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

Advertisements 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"… 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

Advertisements 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":… Read More Regex query not works in EleasticSearch but works in java