QueryStringQuery for date range and integers

Hi, I have some Java code like this:
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); QueryBuilder stringQuery = QueryBuilders.queryStringQuery(query); searchSourceBuilder.query(stringQuery);
I have fields like this in my index:
"runId" : { "type" : "text" }, "startedOn" : { "type" : "date", "format": "yyyy-MM-dd HH:mm:ss.SSSSSS" }, "versionId" : { "type" : "integer" },

I can run queries like 'runId = something' and it works fine, but I am struggling to do the same for the integer ('versionId = 5'), or for date range following examples here (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) like:

StartedOn : [2020-06-20 TO 2020-06-25]

Is there something I'm missing, or are these not possible with QueryStringQuery?

Could you share the code you're running for the version?
BTW remove the space after the field name.

StartedOn:[2020-06-20 TO 2020-06-25]

I did it with no spaces, no luck.

I am using bulk update to update the documents, if that's what you are asking. Sorry I'm new I'm not very familiar with the lingo.

data = {
    "_index": index,
    "_op_type": 'update',
    "doc_as_upsert": True,
    "_id": document_id,
    "doc": doc.__dict__
}

res = bulk(es, es_messages, index=INDEX, raise_on_error=True)

I can do the query easily on Kibana, but not here.

Could you share the full Java code which reproduces the problem and the query you are running in Kibana dev console which works?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.