# Add a record, adding completed, but query failed.

**URL:** <https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202>\
**Category:** General\
**Created:** [September 17, 2021, 8:45am UTC](https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202 "2021-09-17T08:45:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [September 17, 2021, 8:45am UTC](https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202/1 "2021-09-17T08:45:36Z")

</div>

I can use the following ES6 code(worked in chrome) to reproduce this problem in the console of this app.&nbsp;

Note: The app has 200 fields.

```
function update() {
return new Promise((resovle, reject) => {
var body = {
"requests": [
{
"method": "POST",
"api": "/k/v1/record.json",
"payload": {
"app": 12746,
"record": {
"積地結合": {
"value": "testdata"
},
"配車担当者名": {
value: "奥野"
}
}
}
},

]
};

kintone.api(kintone.api.url('/k/v1/bulkRequest', true), 'POST', body, function (resp) {
//success
console.log("Bulk request success");
resovle("Update success");

}, function (error) {
//error
console.log(error);
reject("Update error");
});
});
}

async function query() {
return new Promise((resovle, reject) => {
var query = '(配車担当者名 like "奥野") order by 配車担当者名 asc, 積日 asc, レコード番号 asc limit 500 offset 0';
kintone.api(kintone.api.url('/k/v1/records', true) + '?app=12746&query=' + query, 'GET', {}, function (resp) {
// success
console.log("Requery record count " + resp.records.length);
resovle("OK");
}, function (error) {
// error
console.log(error);
reject("Error");
});

});

}

async function delay(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log("Delay " + ms + " millisecond")
resolve("Delay");
}, ms);
});
}

async function test1() {
await query();
await update();
await query();

}

async function test2() {
await query();
await update();
await delay(2000);
await query();

}

test1();
// Requery record count 56
// Bulk request success
// Requery record count 56 (It is wrong, it should 57)

//test2();
// query record count 57
// Bulk request success
// Delay 2000 millisecond
// Requery record count 58 (It is right, it is the correct result)
```

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [September 18, 2021, 12:25am UTC](https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202/2 "2021-09-18T00:25:14Z")

</div>

Hi Linner,

&nbsp;

In kintone, the full-text search engine is used for refinement searches, including the like API.

&nbsp;

The full-text search engine is updated when a record is registered or updated, but the search result may not be correct if you execute a fetch before the update is complete.

&nbsp;

In this case, test1() executes record retrieval immediately after the record is registered, so the registered records are not retrieved.

&nbsp;

As a workaround, you can wait for the update to finish, so you can retrieve the record typically by waiting for the process to finish, as in test2().

&nbsp;

Hopefully, this helps.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [September 23, 2021, 6:07am UTC](https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202/3 "2021-09-23T06:07:56Z")

</div>

Hello,

Thanks for your quick response. I have one more question:

Besides the like API, is there any other API using the full-text search engine?

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [September 24, 2021, 12:15am UTC](https://forum.kintone.dev/t/add-a-record-adding-completed-but-query-failed/202/4 "2021-09-24T00:15:35Z")

</div>

In the case of operators, “like” and “not like” are applicable since the full-text search applies to “contains/does not contain the following keywords.”

&nbsp;

On the other hand, the following APIs and URLs that can specify query parameters are applicable in the case of APIs.

&nbsp;

Get Records:

[https://developer.kintone.io/hc/en-us/articles/360019245194](https://forum.kintone.dev/hc/en-us/articles/360019245194)

&nbsp;

Bulk record retrieval using the Cursor API method:

[https://developer.kintone.io/hc/en-us/articles/360000361641-Bulk-record-retrieval-using-the-Cursor-API-method](https://forum.kintone.dev/hc/en-us/articles/360000361641-Bulk-record-retrieval-using-the-Cursor-API-method)

&nbsp;

Specify Record List via Query String:

[https://developer.kintone.io/hc/en-us/articles/212494358-Specify-Record-List-via-Query-String](https://forum.kintone.dev/hc/en-us/articles/212494358-Specify-Record-List-via-Query-String)

&nbsp;

Hopefully, this helps.
