I want retrieve data of document who have frameindex equal to 3 and fcntup equal 29225 between tow date
But the result is
{"query":{"range":{"NewlnsServerTimestamp":{"from":"2017-11-14T00:00:00.000Z","to":"2017-11-14T13:27:42.000Z","include_lower":true,"include_upper":true,"boost":1.0}}}}
Is there any solution to have and opertator between query ?
Related
I have a collection with all document ids as epochtime(1613728796). Each of these documents contains up to 50 fields in it. I wanted to query set of documents between specific timing. How I can query based on document's uid?
Query query = db.collection("my-collection").whereGreaterThan("uid", "1613728796")
Try this:
Query query = db.collection("my-collection").whereGreaterThan("__name__", "1613728796").whereLessThan("__name__", "1613728796")
Replace the above epoch times with the correct ones.
If that doesn't work, try replacing "__name" with FieldPath.documentId() or FieldPath.documentId
I am having a dynamo db with a GSI on GSI_ID and range key on lastUpdatedId attribute. I want only 1 task to be rendered which is the latest on the basis of match. This is the expression I am using
DynamoDBQueryExpression<Record> exp =
new DynamoDBQueryExpression<GoldDataRecord>()
.withIndexName(GSI_ID)
.withKeyConditionExpression(KEY_EXP)
.withExpressionAttributeValues(attrValues)
.withLimit(1)
// to get the results in descending order of last updated date giving the latest data first
.withScanIndexForward(false)
.withSelect(Select.ALL_ATTRIBUTES)
.withConsistentRead(false);
private DynamoDBMapper dynamoDBMapper;
PaginatedQueryList<Record> res = dynamoDBMapper.query(Record.class, exp);
But it is fetching all the records that are matching the GSI. What am I doing wrong here?
My java application when using mybatis (3.4.4) to query oracle back end is not returning all the rows when using lazy load.
Essentially,
when I query my database using some SQL tool (like oracle Sql Developer) I get 4000 results
when I query using selectCursor which leads to lazy load conn.selectCusror(query) I only get 560 result!
when I query using selectList which will fetch all result at once conn.selectList(query) I am getting 4000 results (matches with database)
Note: A Cursor offers the same results as a List, except it fetches data lazily using an Iterator. Documentation
This is how I am counting the number of records
Cursor<Object> cur = conn.selectCursor(query) ; // query definition is written below
int count =0;
for(Object ob : cur){
count++;
}
System.out.println(count);
QUERY
<select id="query" fetchSize="20000" resultType="java.util.Map" >
select distinct code from my CODES_VIEW
</select>
Can someone please advise why selectCursor is not giving all the 4000 results
After spending days I found this solution:
My result set from the query contains a row (561) which have null values in its column. This shouldn't be a problem as I can have null values in the columns I fetched . In this case code column has value null at row 561.
When fetching records via selectCursor (lazy method of fetching data) mybatis believes it is end of record when all the columns are null in the fetched row.
MyBatis, by default, returns null when all the columns of a returned
row are NULL. When this setting is enabled, MyBatis returns an empty
instance instead. Note that it is also applied to nested results (i.e.
collectioin and association). Since: 3.4.2
https://mybatis.org/mybatis-3/configuration.html
However, you won't face this problem when you use selectList as all the records are fetched at once and cursor doesn't keep on checking on how does the next fetched records look like .
Hence the solution is to put the below setting in the mybatis config.xml
<setting name="returnInstanceForEmptyRow" value="true" />
H,Essentially In an EMPLOYEE Table that can have multiple records for an employee with different ENTRY_DATE I want to restrict the results of below query by 1 for each employee
SELECT * FROM EMPLOYEE WHERE EMP_NAME IN (...) AND ENTRY_DATE < TODAY ORDER BY ENTRY_DATE DESC
Currently I am fetching all the matching results from the repo and finding the latest record in my Java code, But that creates a problem when emp_list is large and total results are greater than the MaxSize of results, In that case few employees are skipped.
Is there a way to query directly the latest record from the repo in Solr search?
Any help would be appreciated.
Below Solr query gives the required result
q=EMP_NAME&group=true&group.field=EMP_NAME&group.limit=1&sort=ENTRY_DATE desc
Also you can search multiple EMP_NAME
q="EMP_NAME1" OR "EMP_NAME2"&group=true&group.field=EMP_NAME&group.limit=1&sort=ENTRY_DATE desc
Result Grouping -> https://lucene.apache.org/solr/guide/8_1/result-grouping.html
I am working with Mongodb and I need to retrieve set of records with range of specified dates,like from date to to date.
I am using criteria object from java to form a query
But it not considering the equals date
ex:
fromDate:15-09-2017
tdate:23-09-2017
in to date it is not considering 23-09-2017 since it is lte(less than equals) it should take it and fetch the records.
Query query = new Query(Criteria.where("b").elemMatch(Criteria.where("startDate").lte(date).and("endDate").gte(date) )
Can anyone help me on this?