Suppose i have an index with 2 fields as
firstname and lastname both having default values as "test"
Now if I insert a new record in that index
POST my-index-000001/general
{
"firstname": "harry",
"lastname": "potter"
}
and then
POST my-index-000001/general
{
"firstname": "harry1"
}
If i do GET my-index-000001/_search
I should get 2 records with 2nd record having lastname as "test.
How to achieve this?
Please help
The catch is the last note in the null_value documentation
The null_value only influences how data is indexed, it doesn’t modify the _source document.
So your _source is not mdified, and you need to add the fields parameter to your search to get your default indexed value, check the docs.
Also you need the field to be added, that's why the result does not show ron document. If you want to avoid to add the null value you can use an ingest pipeline with the set processor (and an if condition) or a script processor.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.