Wildcard in Path for Match Query

I am looking to build a query filter in java for Elsaticsearch 5.2 to match any of the keywords wether they are author supplied or system generated. I am trying to do a wild card path but it does not return any results. I am using standard dynamic mapping in Elasticsearch.

{
    "content": {
        "title": "The History of Cats",
        "description": "A brief history of cats.",
        "keywords": {
            "author": ["cat"],
            "system": ["felis", "animalia"]
        }
    }
}

Ideally, if a user searches with the keyword cat or felis they should get a hit on this record. Currently, I do not receive any hits. Is this something that can be achieved through this query builder or another? Do I need to tweak mappings?

BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
queryBuilder.filter(QueryBuilders.matchQuery("content.keywords.*", keyword));

SearchRequestBuilder searchRequestBuilder = this.client.prepareSearch("my-index")
                .setTypes("article")
                .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
                .setQuery(queryBuilder)
                .setFrom(0)
                .setSize(10)
                .addSort(SortBuilders.scoreSort());

SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();

return searchResponse;

Thanks Drew

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.