Reputation: 1640
I have simple question. I'm indexing JSON files that contains several fields into Elasticsearch. How to say ElasticSearch to ignore (don't index and store them at all) group of defined fields from the incoming file OR to work only with defined group of fields? Is this possible by using the mapping?
For example: I have JSON files like this:
{
"id": 123456789,
"name": "Name value",
"screenName": "Nick name",
"location": "Location value",
"description": "Description text",
"url": "url value",
"anotherField": 456789,
"status": null,
"anotherField2": "9AE4E8",
"color": "333333",
.......
}
And now I want to Elasticsearch works only with fields (for example) "id;name;description;location;status;url" and ingnore other fields.
Any help? Thanks.
Upvotes: 4
Views: 1884
Reputation: 2221
When you serialize the data into a json using a DTO(POJO), you can mark the fields which you dont want to index using @Jsonignore annotation if you are using Jackson serializer/desrializer.
eg: @JsonIgnore private Date creationDate;
package com.fasterxml.jackson.annotation;
Upvotes: 1