The data is “immutable enough”. We’re using it to speed up searches by name for customers as mysql is taking a hammering (along with a few other filters, all in the _includes). The final result is distilled down to customer ids. We plan on only adding documents, so even if a customer’s name changes, a new document appears and there’s a match on their old and new names for their id - so no problem (the agent using this will confirm their details, since this would be for a food order, and I don’t even think they update details that regularly, to be honest). Documents are added per order the customer places, and there’s a backfill workflow to index historical orders.
However, I have a new problem now: I’ve been developing against elasticsearch:9.2.1 (docker), and stuff has been working nicely. However, testing at our staging deployment, which is pointed to an ES serverless cloud instance, the index cannot be created. I see a message like:
Parameter [includes] is not allowed in source
My mapping according to the local index is:
{
"test-shouldreturnfindtheexactmatch-20251126122212": {
"aliases": {
"moo": {}
},
"mappings": {
"properties": {
"brand_id": {
"type": "long"
},
"call_center_id": {
"type": "long"
},
"customer_id": {
"type": "long"
},
"date": {
"type": "date"
},
"first_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"group_id": {
"type": "long"
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"last_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"order_id": {
"type": "long"
},
"source": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"store_id": {
"type": "long"
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "test-shouldreturnfindtheexactmatch-20251126122212",
"creation_date": "1764152532620",
"number_of_replicas": "1",
"uuid": "g4bOzoLTR-CsKV_O2YdiZw",
"version": {
"created": "9039001"
}
}
}
}
}
and I’m using the official dotnet client (Elastic.Clients.Elasticsearch) with my index setup as follows:
var createIndexResponse = client.Indices.Create<OrderIndexItem>(index =>
index.Index(IndexName)
.Mappings(m =>
m.Source(s =>
s.Includes(
GenerateIncludedPropertyNames()
)
)
.Properties(p =>
p.Keyword(o => o.Id)
).Properties(p =>
p.IntegerNumber(o => o.OrderId)
).Properties(p =>
p.IntegerNumber(o => o.CallCenterId)
).Properties(p =>
p.IntegerNumber(o => o.StoreId)
).Properties(p =>
p.IntegerNumber(o => o.GroupId)
).Properties(p =>
p.Keyword(s => s.FirstName)
).Properties(p =>
p.Keyword(o => o.LastName)
).Properties(p =>
p.Date(o => o.Date)
)
)
);
where GenerateIncludedPropertyNames generates property names from the [JsonPropertyName(…)] annotations on the model, and drops properties marked with [PersonalIdentifier]. This code generated the above index locally, but fails to generate an index at ES cloud, which has been set up with a serverless instance.
Any help appreciated.