djikon
August 3, 2021, 9:05am
1
Hi,
I create a script field and i have a lot of shards failed.
my script field is just :
doc['evenement.@timestamp '].value.getMillis() - doc['debutSejour'].value.getMillis()
shards failed exist too fort :
if(doc['evenement.categorieMouvement'].value.contains("Exit") && !doc['evenement.@timestamp '].empty) { return (doc['evenement.@timestamp '].value - doc['debutSejour'].value) } else { return null; }
my version is 6.5.4
help me please !
thank you
is your time field actually "evenement.@timestamp "? If that is correct you might have to add a check in the scripted field for the field existing in the document if not all documents contain all those fields.
warkolm
(Mark Walkom)
August 3, 2021, 11:29pm
3
Welcome to our community!
I just wanted to pop in and make mention that 6.5 has been EOL for over a year now, please upgrade ASAP.
djikon
August 4, 2021, 8:53am
4
Hi,
"evenement.@timestamp " is my time field for 1 event and i confirm this field is not present in all documents.
my new script >
if (doc.containsKey('evenement.@timestamp') || doc.containsKey('debutSejour')) { return doc['evenement.@timestamp'].value - doc['debutSejour'].value } else { return null }
dev tools return >
{
"took" : 62,
"timed_out" : false,
"_shards" : {
"total" : 353,
"successful" : 353,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 2544886,
"max_score" : 1.0,
but allways shards failed =(
You need an "AND" instead of the "OR" here:
if (doc.containsKey('evenement.@timestamp') || doc.containsKey('debutSejour'))
djikon
August 4, 2021, 10:14am
6
if (doc.containsKey('evenement.@timestamp') && doc.containsKey('debutSejour')) { return doc['evenement.@timestamp'].value - doc['debutSejour'].value } else { return null }
same result :
{
"took" : 82,
"timed_out" : false,
"_shards" : {
"total" : 353,
"successful" : 353,
"skipped" : 0,
"failed" : 0
},
preview result >
[
{
"_id": "6DFq0XkBjzvHLYjgrDwS",
"Duree du sejour": [
null
]
},
djikon
August 9, 2021, 7:26am
7
hi i have resolved my problem.
thank you
system
(system)
Closed
September 6, 2021, 7:26am
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.