I want to just index all of the fields without storing them.
How?
bulkRequest.add(client.prepareIndex("sponge2", "153299", "ID")
.setSource(jsonBuilder()
.startObject()
.field("hostname", hostName2)
.field("logtype", logType2)
.field("env", env2)
.field("logpath", logPath2)
.field("logfilename", logFileName2)
.field("timestamp", timeStamp)
.field("eventbody", sCurrentLine)
.endObject()
)
);
I want "hostname","logtype","env","logpath","logfilename","timestamp"
and "eventbody" indexed but not stored.
And later I use these field as filters just get the "ID".
Acutally, it may not be necessary to use "source".
I just want to index all the fields and later I search them with a
unique ID.
I'm new to search. Maybe it's stupid question.
I want to just index all of the fields without storing them.
How?
bulkRequest.add(client.prepareIndex("sponge2", "153299", "ID")
.setSource(jsonBuilder()
.startObject()
.field("hostname", hostName2)
.field("logtype", logType2)
.field("env", env2)
.field("logpath", logPath2)
.field("logfilename", logFileName2)
.field("timestamp", timeStamp)
.field("eventbody", sCurrentLine)
.endObject()
)
);
I want "hostname","logtype","env","logpath","logfilename","timestamp"
and "eventbody" indexed but not stored.
And later I use these field as filters just get the "ID".
I'm new to search. Maybe it's a stupid question.
Actually, I want all the fields indexed to be searchable later.
Then I just get the id by filtering those fields.
Maybe "ID" is not nessary because I see there is a setID method.
What's the differences?
I want to just index all of the fields without storing them.
How?
bulkRequest.add(client.prepareIndex("sponge2", "153299", "ID")
.setSource(jsonBuilder()
.startObject()
.field("hostname", hostName2)
.field("logtype", logType2)
.field("env", env2)
.field("logpath", logPath2)
.field("logfilename", logFileName2)
.field("timestamp", timeStamp)
.field("eventbody", sCurrentLine)
.endObject()
)
);
I want "hostname","logtype","env","logpath","logfilename","timestamp"
and "eventbody" indexed but not stored.
And later I use these field as filters just get the "ID".
.field("eventbody", sCurrentLine)
.endObject()
)
);
I want "hostname","logtype","env","logpath","logfilename","timestamp"
and "eventbody" indexed but not stored.
And later I use these field as filters just get the "ID".
You are already there in building the data for a document, similar to that you have to build mappings as informed by Chris Male.
You can do that as below: (make sure index is already created before executing this request, and _source field is disabled as below.)
XContentBuilder data = XContentFactory.jsonBuilder().startObject()
.startObject("settings")
.startObject("_source")
.field("enabled", false)
.endObject()
.startObject("properties")
.startObject("content0")
.field("type", "string")
.endObject()
.startObject("content1")
.field("type", "string")
.field("store", "no")
.endObject()
.endObject().endObject()
.endObject();
by default only _source is stored, other fields are not stored by default.
so in your case you can simply set "_source" : {"store" : false} via the
mapping API when you create the index. here are some more details:
.field("eventbody", sCurrentLine)
.endObject()
)
);
I want "hostname","logtype","env","logpath","logfilename","timestamp"
and "eventbody" indexed but not stored.
And later I use these field as filters just get the "ID".
You are already there in building the data for a document, similar to that
you have to build mappings as informed by Chris Male.
You can do that as below: (make sure index is already created before
executing this request, and _source field is disabled as below.)
XContentBuilder data =
XContentFactory.jsonBuilder().startObject()
.startObject("settings")
.startObject("_source")
.field*("enabled", false)*
.endObject()
.startObject("properties")
.startObject("content0")
.field("type", "string")
.endObject()
.startObject("content1")
.field("type", "string")
.field*("store", "no")*
.endObject()
.endObject().endObject()
.endObject();
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.