All: First, I plead guilty for being naive about setting up a mapping for an ES Index.
Ultimately I would like to set up an aggregation on an array that I have defined in my mapping. See "pathWithType" here:
XContentBuilder builder = jsonBuilder()
.startObject()
.startObject(XXXXXX)
.startObject("properties")
.startObject("latlon").field("type", "geo_point").endObject()
.startObject("path").field("type", "text").field("analyzer", "path-analyzer")
.field("fielddata", true).endObject()
.startArray("pathWithType")
.startObject("path").field("type", "text").field("analyzer", "path-analyzer")
.field("fielddata", true).endObject()
.startObject("fullPath").field("type", "keyword").field("index", "true").endObject()
.startObject("pathType").field("type", "text").field("index", "true").endObject()
.endArray()
.startObject("emailString").field("type", "text").field("analyzer", "url-email-
analyzer").endObject()
.startObject("fullPath").field("type", "keyword").field("index", "true").endObject()
.startObject("statesKW").field("type", "text")
.field("analyzer", "keyword").field("fielddata", true).endObject()
.startObject("audiences").field("type", "text")
.field("analyzer", "keyword").field("fielddata", true).endObject()
.startObject("orgTypes").field("type", "text").field("analyzer", "keyword")
.field("fielddata", true).endObject()
.startObject("suggest").field("type", "completion").endObject()
.startObject("linkUrl").field("type", "text").field("analyzer",
"domain_name_analyzer").endObject()
.startObject("linkText").field("type", "text").field("analyzer",
"domain_name_analyzer").endObject()
.startObject("details").field("type", "text").field("analyzer",
"domain_name_analyzer").endObject()
.startObject("legalName").field("type", "text").endObject()
.startObject("pathType").field("type", "text").endObject()
.endObject()
.endObject()
.endObject();
With this mapping I get a successful build of the index using the BulkProcessor.
However, with the "pathWithType" array defined in this mapping, when my application runs a search against the index ES returns:
Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
Obviously the source of this issue must have to do with the array definition in that XContentBuilder mapper. Can somebody please enlighten to what is probably a simple error I have in my mapping?
And also, would I be able to create an aggregation against the "pathWithType" array, like this:
AggregationBuilder subjectAggWithType = AggregationBuilders.terms("subjectWithType").field("pathWithType"))
... or some such syntax?
As always, thank you for your time and assisance.
Gary