Hello,
I am new to ElasticSearch and I was building a simple service that would
store some documents. I used a local node like :
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("node.name", "ligatus-dsp-aggregation-embedded");
settings.put("path.data", this.url);
settings.put("http.enabled", false);
Node node = NodeBuilder
.nodeBuilder()
.settings(settings)
.local(true)
.node();
Client client = node.client();
I write then plain json docs into one index and assign already an id:
IndexResponse response = client
.prepareIndex(this.index, this.type, "http://www.myID.com")
.setSource(json)
.execute()
.actionGet();
If I try to retrieve the document by its id everything works fine.
GetResponse response = getClient()
.prepareGet(this.index, this.type, "http://www.myID.com")
.execute()
.actionGet();
// works fine.
However if I want to search (by field), count and retrieve all entries, I always get 0 resutls. My code looks like:
SearchResponse response = getClient()
.prepareSearch(this.index)
.setTypes(this.type)
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(QueryBuilders.matchQuery(aField, aValue))
.execute()
.actionGet();
// 0 hits
I am not sure why this happens? Maybe because the new documents are not indexed and thus not searchable? Or what could be the issue?
Best Regards,
Klaus
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0256f12f-bb8b-49c2-91fc-4159973900aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.